fteqw/engine/client/cl_input.c

2660 lines
77 KiB
C
Raw Normal View History

/*
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// cl.input.c -- builds an intended movement command to send to the server
#include "quakedef.h"
#ifdef _WIN32
#include "winquake.h" //fps indep stuff.
#endif
float in_sensitivityscale = 1;
static void QDECL CL_SpareMsec_Callback (struct cvar_s *var, char *oldvalue);
#ifdef NQPROT
static cvar_t cl_movement = CVARD("cl_movement","1", "Specifies whether to send movement sequence info over DPP7 protocols (other protocols are unaffected). Unlike cl_nopred, this can result in different serverside behaviour.");
#endif
cvar_t cl_nodelta = CVAR("cl_nodelta","0");
cvar_t cl_c2sdupe = CVAR("cl_c2sdupe", "0");
cvar_t cl_c2spps = CVARD("cl_c2spps", "0", "Reduces outgoing packet rates by dropping up to a third of outgoing packets.");
cvar_t cl_c2sImpulseBackup = CVARD("cl_c2sImpulseBackup","3", "Prevents the cl_c2spps setting from dropping redundant packets that contain impulses, in an attempt to keep impulses more reliable.");
cvar_t cl_netfps = CVARD("cl_netfps", "150", "Send up to this many packets to the server per second. The rate used is also limited by the server which usually forces a cap to this setting of 77. Low packet rates can result in extra extrapolation to try to hide the resulting latencies.");
cvar_t cl_sparemsec = CVARCD("cl_sparemsec", "10", CL_SpareMsec_Callback, "Allows the 'banking' of a little extra time, so that one slow frame will not delay the timing of the following frame so much.");
cvar_t cl_queueimpulses = CVARD("cl_queueimpulses", "0", "Queues unsent impulses instead of replacing them. This avoids the need for extra wait commands (and the timing issues of such commands), but potentially increases latency and can cause scripts to be desynced with regard to buttons and impulses.");
cvar_t cl_smartjump = CVARD("cl_smartjump", "1", "Makes the jump button act as +moveup when in water. This is typically quieter and faster.");
Too many changes, sorry. Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds. Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system). Add mastervolume cvar (for ss). Add r_shadows 2 (aka fake shadows - for ss). Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss). Better support for some effectinfo hacks (for ss). Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss). Rework the dpcsqc versions of project+unproject builtins for better compat (for ss). Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss). Better compat with DP's loadfont console command (for ss). Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss). Detect dp's m_draw extension, to work around it (for ss). Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss). loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts. Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0. Hackily parse emoji.json to provide :poop: etc suggestions. Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic. screenshot_cubemap will now capture half-float images when saving to ktx or dds files. Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings. Fixed size of gfx/loading.lmp when replacement textures are used. Added mipmap support for rg8 and l8a8 textures. r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones. Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP). Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research. Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates. Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds. Added setmousepos builtin. Should work with glx+win32 build. VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees). Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding). Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW). sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories. edit command now displays end1.bin/end2.bin correctly, because we can. Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant. Fix threading race condition in sha1 lookups. Updated f_ruleset to include the same extra flags reported by ezquake. A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc). fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only. HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written). Fixed buf_cvarlist, should work in xonotic now, and without segfaults. Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though. Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs. sdl: support custom icons. sdl: support choosing a specific display. Added some documentation to menuqc builtins. menusys: use outlines for slightly more readable fonts. menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
cvar_t cl_iDrive = CVARFD("cl_iDrive", "1", CVAR_SEMICHEAT, "Effectively releases movement keys when the opposing key is pressed. This avoids dead-time when both keys are pressed. This can be emulated with various scripts, but that's messy.");
rewrote ban code, merging bans+nonbans+cuffs+mute+cripple+deaf+lagged+vip. added timeouts. new penalties have no dedicated command. use the addip command for it. maplist command now generates links. implemented skin objects for q3. added a csqc builtin for it. also supports compositing skins. playing demos inside zips/pk3s/paks should now work. bumped default rate cvar. added cl_transfer to attempt to connect to a new server without disconnecting first. rewrote fog command. alpha and mindist arguments are now supported. fog change also happens over a short time period. added new args to the showpic console command. can now create clickable items for touchscreen/absmouse users. fixed menus to properly support right-aligned text. this finally fixes variable-width fonts. rewrote console tab completion suggestions display. now clickable links. strings obtained from qc are now marked as const. this has required quite a few added consts all over the place. probably crappy attempt at adding joypad support to the sdl port. no idea if it works. changed key bind event code. buttons now track which event they should trigger when released, instead of being the same one the whole time. this allows +forward etc clickable buttons on screen. Also simplified modifier keys - they no longer trigger random events when pressing the modifier key itself. Right modifiers can now be bound separately from left modifiers. Right will use left's binding if not otherwise bound. Bind assumes left if there's no prefix. multiplayer->setup->network menu no longer crashes. added rgb colours to the translation view (but not to the colour-changing keys). added modelviewer command to view models. added menu_mods menu to switch mods in a more friendly way. will be shown by default if multiple manifests exist in the binarydir. clamped classic tracer density. scrag particles no longer look quite so buggy. added ifdefs to facilitate a potential winrt port. the engine should now have no extra dependencies, but still needs system code+audio drivers to be written. if it can't set a renderer, it'll now try to use *every* renderer until it finds one that works. added experimental mapcluster server mode (that console command). New maps will be started up as required. rewrote skeletal blending code a bit. added cylinder geomtypes. fix cfg_save writing to the wrong path bug. VFS_CLOSE now returns a boolean. false means there was some sort of fatal error (either crc when reading was bad, or the write got corrupted or something). Typically ignorable, depends how robust you want to be. win32 tls code now supports running as a server. added connect tls://address support, as well as equivalent sv_addport support. exposed basic model loading api to plugins. d3d11 backend now optionally supports tessellation hlsl. no suitable hlsl provided by default. !!tess to enable. attempted to add gamma ramp support for d3d11. added support for shader blobs to speed up load times. r_shaderblobs 1 to enable. almost vital for d3d11. added vid_srgb cvar. shadowless lights are no longer disabled if shadows are not supported. attempt to add support for touchscreens in win7/8. Wrote gimmicky lua support, using lua instead of ssqc. define VM_LUA to enable. updated saved game code. can again load saved games from vanilla-like engines. changed scale clamping. 0.0001 should no longer appear as 1. changed default mintic from 0.03 to 0.013 to match vanilla qw. I don't know why it was at 0.03. probably a typo. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4623 fc73d0e0-1445-4013-8a0c-d673dee63da5
2014-03-30 09:55:06 +01:00
cvar_t cl_run = CVARD("cl_run", "0", "Enables autorun, inverting the state of the +speed key.");
cvar_t cl_fastaccel = CVARD("cl_fastaccel", "1", "Begin moving at full speed instantly, instead of waiting a frame or so.");
extern cvar_t cl_rollspeed;
static cvar_t cl_sendchatstate = CVARD("cl_sendchatstate", "1", "Announce your chat state to the server in a privacy-violating kind of way. This allows other players to see your afk/at-console status.");
cvar_t cl_prydoncursor = CVAR("cl_prydoncursor", ""); //for dp protocol
cvar_t cl_instantrotate = CVARF("cl_instantrotate", "1", CVAR_SEMICHEAT);
cvar_t in_xflip = {"in_xflip", "0"};
cvar_t prox_inmenu = CVAR("prox_inmenu", "0");
usercmd_t cl_pendingcmd[MAX_SPLITS];
/*kinda a hack...*/
unsigned int con_splitmodifier;
cvar_t cl_forceseat = CVARAD("in_forceseat", "0", "in_forcesplitclient", "Overrides the device identifiers to control a specific client from any device. This can be used for debugging mods, where you only have one keyboard/mouse.");
extern cvar_t cl_splitscreen;
int CL_TargettedSplit(qboolean nowrap)
{
int mod;
//explicitly targetted at some seat number from the server
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
if (Cmd_ExecLevel >= RESTRICT_SERVER)
return Cmd_ExecLevel - RESTRICT_SERVER;
//locally executed command.
if (nowrap)
mod = MAX_SPLITS;
else
mod = cl.splitclients;
if (mod < 1)
return 0;
if (con_splitmodifier > 0)
return (con_splitmodifier - 1) % mod;
else if (cl_forceseat.ival > 0)
return (cl_forceseat.ival-1) % cl.splitclients;
else
return 0;
}
void CL_Split_f(void)
{
int tmp;
char *c;
c = Cmd_Argv(0);
tmp = con_splitmodifier;
if (*c == '+' || *c == '-')
{
con_splitmodifier = c[2]-'0';
Cmd_ExecuteString(va("%c%s", *c, Cmd_Args()), Cmd_ExecLevel);
}
else
{
con_splitmodifier = c[1]-'0';
Cmd_ExecuteString(Cmd_Args(), Cmd_ExecLevel);
}
con_splitmodifier = tmp;
}
void CL_SplitA_f(void)
{
int tmp;
char *c, *args;
c = Cmd_Argv(0);
args = COM_Parse(Cmd_Args());
if (!args)
return;
while(*args == ' ' || *args == '\t')
args++;
tmp = con_splitmodifier;
con_splitmodifier = atoi(com_token);
if (*c == '+' || *c == '-')
Cmd_ExecuteString(va("%c%s", *c, args), Cmd_ExecLevel);
else
Cmd_ExecuteString(args, Cmd_ExecLevel);
con_splitmodifier = tmp;
}
/*
===============================================================================
KEY BUTTONS
Continuous button event tracking is complicated by the fact that two different
input sources (say, mouse button 1 and the control key) can both press the
same button, but the button should only be released when both of the
pressing key have been released.
When a key event issues a button command (+forward, +attack, etc), it appends
its key number as a parameter to the command so it can be matched up with
the release.
state bit 0 is the current state of the key
state bit 1 is edge triggered on the up to down transition
state bit 2 is edge triggered on the down to up transition
===============================================================================
*/
kbutton_t in_mlook, in_strafe, in_speed;
static kbutton_t in_klook;
static kbutton_t in_left, in_right, in_forward, in_back;
static kbutton_t in_lookup, in_lookdown, in_moveleft, in_moveright;
static kbutton_t in_use, in_jump, in_attack;
static kbutton_t in_rollleft, in_rollright, in_up, in_down;
static kbutton_t in_button[19+1];
fix colormod added frag message filter, and dedicated frag tracker. added 'windowed consoles' for social-type stuff without depending upon csqc mods for it. added in_deviceids command which allows listing/renumbering device ids. slider widgets now support inverted ranges, so gamma selection isn't so weird. fix top/bottom colour selection bug. software banding feature is now part of the 'software' preset (now that it supports mipmaps). support for loading .maps, and editing their brushes etc (with appropriate qc mod). 'map mymap.map' to use. expect problems with missing wads and replacement textures overriding them and messing up texture scales. snd_inactive is now default. fix threading issue with wavs, no more error from 0-sample-but-otherwise-valid wavs. added -makeinstaller option to embed a manifest inside the exe (and icon). the resulting program will insist on installing the game if its run from outside a valid basedir. framegroup support for q1mdl. textures are now loaded on multiple worker threads, for reduced load times. moo har har. netgraph shows packet+byte rates too. added r_lightstylescale, pretty similar to contrast, but doesn't impose any framerate cost, but may have overbrighting issues. r_softwarebanding now works on q2bsp too. fixed crepuscular lights. gzip transfer encoding is performed while downloading, instead of inducing stalls. FINALLY fix ezquake download compat issue (dimman found the issue). git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4851 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-04-15 00:12:17 +01:00
#define IN_IMPULSECACHE 32
static int in_impulse[MAX_SPLITS][IN_IMPULSECACHE];
static int in_nextimpulse[MAX_SPLITS];
static int in_impulsespending[MAX_SPLITS];
static void CL_QueueImpulse (int pnum, int newimp)
{
if (cl_queueimpulses.ival)
{
if (in_impulsespending[pnum]>=IN_IMPULSECACHE)
{
Con_Printf("Too many impulses, ignoring %i\n", newimp);
return;
}
in_impulse[pnum][(in_nextimpulse[pnum]+in_impulsespending[pnum])%IN_IMPULSECACHE] = newimp;
in_impulsespending[pnum]++;
}
else
{
if (in_impulsespending[pnum])
Con_DPrintf("Too many impulses, forgetting %i\n", in_impulse[pnum][(in_nextimpulse[pnum])%IN_IMPULSECACHE]);
in_impulse[pnum][(in_nextimpulse[pnum])%IN_IMPULSECACHE] = newimp;
in_impulsespending[pnum]=1;
}
}
qboolean cursor_active;
static qboolean KeyDown_Scan (kbutton_t *b, kbutton_t *anti, int k)
{
int pnum = CL_TargettedSplit(false);
if (k == b->down[pnum][0] || k == b->down[pnum][1])
return false; // repeating key
if (!b->down[pnum][0])
b->down[pnum][0] = k;
else if (!b->down[pnum][1])
b->down[pnum][1] = k;
else
{
Con_DPrintf ("Three keys down for a button!\n");
return false;
}
if (b->state[pnum] & 1)
return false; // still down
b->state[pnum] |= 1 + 2; // down + impulse down
if (anti && (anti->state[pnum] & 1) && cl_iDrive.ival)
{ //anti-keys are the opposing key. so +forward can auto-release +back for slightly faster-responding keypresses.
b->suppressed[pnum] = anti;
anti->suppressed[pnum] = NULL;
anti->state[pnum] &= ~1; // now up
anti->state[pnum] |= 4; // impulse up
}
return true;
}
static void KeyDown (kbutton_t *b, kbutton_t *anti)
{
int k;
char *c;
c = Cmd_Argv(1);
if (c[0])
k = atoi(c);
else
k = -1; // typed manually at the console for continuous down
KeyDown_Scan(b, anti, k);
}
static qboolean KeyUp_Scan (kbutton_t *b, int k)
{
int pnum = CL_TargettedSplit(false);
if (k < 0)
{ // typed manually at the console, assume for unsticking, so clear all
b->suppressed[pnum] = NULL;
b->down[pnum][0] = b->down[pnum][1] = 0;
if (b->state[pnum] & ~4)
{
b->state[pnum] = 4; // impulse up
return true;
}
return false;
}
if (b->down[pnum][0] == k)
b->down[pnum][0] = 0;
else if (b->down[pnum][1] == k)
b->down[pnum][1] = 0;
else
return false; // key up without coresponding down (menu pass through)
if (b->down[pnum][0] || b->down[pnum][1])
return false; // some other key is still holding it down
if (!(b->state[pnum] & 1))
return false; // still up (this should not happen)
b->state[pnum] &= ~1; // now up
b->state[pnum] |= 4; // impulse up
if (b->suppressed[pnum])
{
if (b->suppressed[pnum]->down[pnum][0] || b->suppressed[pnum]->down[pnum][1])
b->suppressed[pnum]->state[pnum] |= 1 + 2;
b->suppressed[pnum] = NULL;
}
return true;
}
static qboolean KeyUp (kbutton_t *b)
{
int k;
char *c;
c = Cmd_Argv(1);
if (c[0])
k = atoi(c);
else
k = -1;
return KeyUp_Scan(b, k);
}
#ifdef QUAKESTATS
static cvar_t cl_weaponhide = CVARD("cl_weaponhide", "0", "HACK: Attempt to switch weapon to another in order to cheat your killer out of any possible weapon upgrades.\n0: original behaviour\n1: switch away when +attack/+fire is released\n2: switch away only in deathmatch\n");
static cvar_t cl_weaponhide_preference = CVARAD("cl_weaponhide_preference", "2 1", "cl_weaponhide_axe", "The weapon you would like to try to switch to when cl_weaponhide is active");
static cvar_t cl_weaponpreselect = CVARD("cl_weaponpreselect", "0", "HACK: Controls the interaction between the ^aweapon^a and ^a+attack^a commands (does not affect ^aimpulse^a).\n0: weapon switch happens instantly\n1: weapon switch happens on next attack\n2: instant only when already firing, otherwise delayed\n3: delay until new attack only in deathmatch 1\n4: delay until any attack only in deathmatch 1");
static cvar_t cl_weaponforgetorder = CVARD("cl_weaponforgetorder", "0", "The 'weapon' command will lock in its weapon choice, instead of choosing a different weapon between select+fire.");
cvar_t r_viewpreselgun = CVARD("r_viewpreselgun", "0", "HACK: Display the preselected weaponmodel, instead of the current weaponmodel.");
static int preselectedweapons[MAX_SPLITS];
static int preselectedweapon[MAX_SPLITS][32];
//hacks, because we have to guess what the mod is doing. we'll probably get it wrong, which sucks.
static qboolean IN_HaveWeapon(int pnum, int imp)
{
unsigned int items = cl.playerview[pnum].stats[STAT_ITEMS];
switch (imp)
{
case 1: return (items & IT_AXE)?true:false;
case 2: return (items & IT_SHOTGUN && cl.playerview[pnum].stats[STAT_SHELLS] >= 1)?true:false;
case 3: return (items & IT_SUPER_SHOTGUN && cl.playerview[pnum].stats[STAT_SHELLS] >= 2)?true:false;
case 4: return (items & IT_NAILGUN && cl.playerview[pnum].stats[STAT_NAILS] >= 1)?true:false;
case 5: return (items & IT_SUPER_NAILGUN && cl.playerview[pnum].stats[STAT_NAILS] >= 2)?true:false;
case 6: return (items & IT_GRENADE_LAUNCHER && cl.playerview[pnum].stats[STAT_ROCKETS] >= 1)?true:false;
case 7: return (items & IT_ROCKET_LAUNCHER && cl.playerview[pnum].stats[STAT_ROCKETS] >= 1)?true:false;
case 8: return (items & IT_LIGHTNING && cl.playerview[pnum].stats[STAT_CELLS] >= 1)?true:false;
}
return false;
}
static int IN_BestWeapon_Pre(unsigned int pnum);
//if we're using weapon preselection, then we probably also want to show which weapon will be selected, instead of showing the shotgun the whole time.
//this of course requires more hacks.
const char *IN_GetPreselectedViewmodelName(unsigned int pnum)
{
static const char *nametable[] =
{
NULL, //can't cope with a 0
"progs/v_axe.mdl",
"progs/v_shot.mdl",
"progs/v_shot2.mdl",
"progs/v_nail.mdl",
"progs/v_nail2.mdl",
"progs/v_rock.mdl",
"progs/v_rock2.mdl",
"progs/v_light.mdl",
};
if (r_viewpreselgun.ival && cl_weaponpreselect.ival && pnum < countof(preselectedweapons) && preselectedweapons[pnum])
{
int best = IN_BestWeapon_Pre(pnum);
if (best < countof(nametable))
return nametable[best];
}
return NULL;
}
//FIXME: make a script to decide if a weapon is held? call into the csqc?
static int IN_BestWeapon_Args(unsigned int pnum, int firstarg, int argcount)
{
int i, imp;
unsigned int best = 0;
for (i = firstarg + argcount; --i >= firstarg; )
{
imp = Q_atoi(Cmd_Argv(i));
if (IN_HaveWeapon(pnum, imp))
best = imp;
}
return best;
}
static int IN_BestWeapon_Pre(unsigned int pnum)
{
int i, imp;
unsigned int best = 0;
for (i = preselectedweapons[pnum]; i-- > 0; )
{
imp = preselectedweapon[pnum][i];
if (IN_HaveWeapon(pnum, imp))
best = imp;
}
return best;
}
static void IN_DoPostSelect(void)
{
if (cl_weaponpreselect.ival)
{
int pnum = CL_TargettedSplit(false);
int best = IN_BestWeapon_Pre(pnum);
if (best)
CL_QueueImpulse(pnum, best);
}
}
//The weapon command autoselects a prioritised weapon like multi-arg impulse does.
//however, it potentially makes the switch only on the next +attack.
void IN_Weapon (void)
{
int newimp;
int pnum = CL_TargettedSplit(false);
int mode, best, i;
for (i = 1; i < Cmd_Argc() && i <= countof(preselectedweapon[pnum]); i++)
preselectedweapon[pnum][i-1] = atoi(Cmd_Argv(i));
preselectedweapons[pnum] = i-1;
best = IN_BestWeapon_Pre(pnum);
if (best)
{
newimp = best;
if (cl_weaponforgetorder.ival)
{ //make sure the +attack sticks with the selected weapon.
preselectedweapon[pnum][0] = best;
preselectedweapons[pnum] = 1;
}
}
else
return; //no new weapon...
mode = cl_weaponpreselect.ival;
if (mode == 3)
mode = (cl.deathmatch==1)?1:0;
else if (mode == 4)
mode = (cl.deathmatch==1)?2:0;
if (mode == 1)
return; //don't change yet.
if (mode == 2 && !(in_attack.state[pnum]&3))
return; //2 changes instantly only when already firing.
CL_QueueImpulse(pnum, newimp);
}
//+fire 8 7 [keycode]
//does impulse 8 or 7 (according to held weapons) along with a +attack
void IN_FireDown(void)
{
int pnum = CL_TargettedSplit(false);
int k;
int impulse;
impulse = Cmd_Argc()-1;
k = atoi(Cmd_Argv(impulse));
if (k >= 32)
impulse--; //scancode, don't treat that arg as a weapon number
else
k = -1;
impulse = IN_BestWeapon_Args(pnum, 1, impulse);
if (impulse)
CL_QueueImpulse(pnum, impulse);
else
IN_DoPostSelect();
KeyDown_Scan(&in_attack, NULL, k);
}
static void IN_DoWeaponHide(void)
{
if (cl_weaponhide.ival && !(cl_weaponhide.ival==2 && cl.deathmatch==1))
{
int impulse, best = 0;
int pnum = CL_TargettedSplit(false);
char tok[64];
char *l = cl_weaponhide_preference.string;
if (!strcmp(l, "0")) l = "2"; //for compat with ezquake's cl_weaponhide_axe cvar.
while(l && *l)
{
l = COM_ParseOut(l, tok, sizeof(tok));
impulse = atoi(tok);
if (IN_HaveWeapon(pnum, impulse))
best = impulse;
}
if (best)
{ //looks like we're switching away
CL_QueueImpulse(pnum, best);
}
}
}
//-fire should trigger an impulse 1 or something.
void IN_FireUp(void)
{
int k;
int impulse;
//any args are used in the +fire version and linger through to the -fire.
//the only useful one is the keynum.
impulse = Cmd_Argc()-1;
k = atoi(Cmd_Argv(impulse));
if (k >= 32)
impulse--; //scancode, don't treat that arg as a weapon number
else
k = -1;
if (KeyUp_Scan(&in_attack, k))
IN_DoWeaponHide();
}
#else
#define IN_DoPostSelect()
#define IN_DoWeaponHide()
#endif
static void IN_KLookDown (void) {KeyDown(&in_klook, NULL);}
static void IN_KLookUp (void) {KeyUp(&in_klook);}
static void IN_MLookDown (void) {KeyDown(&in_mlook, NULL);}
static void IN_MLookUp (void)
{
int pnum = CL_TargettedSplit(false);
KeyUp(&in_mlook);
if ( !(in_mlook.state[pnum]&1) && lookspring.ival)
V_StartPitchDrift(&cl.playerview[pnum]);
}
static void IN_UpDown(void) {KeyDown(&in_up, &in_down);}
static void IN_UpUp(void) {KeyUp(&in_up);}
static void IN_DownDown(void) {KeyDown(&in_down, &in_up);}
static void IN_DownUp(void) {KeyUp(&in_down);}
static void IN_LeftDown(void) {KeyDown(&in_left, &in_right);}
static void IN_LeftUp(void) {KeyUp(&in_left);}
static void IN_RightDown(void) {KeyDown(&in_right, &in_left);}
static void IN_RightUp(void) {KeyUp(&in_right);}
static void IN_ForwardDown(void) {KeyDown(&in_forward, &in_back);}
static void IN_ForwardUp(void) {KeyUp(&in_forward);}
static void IN_BackDown(void) {KeyDown(&in_back, &in_forward);}
static void IN_BackUp(void) {KeyUp(&in_back);}
static void IN_LookupDown(void) {KeyDown(&in_lookup, &in_lookdown);}
static void IN_LookupUp(void) {KeyUp(&in_lookup);}
static void IN_LookdownDown(void) {KeyDown(&in_lookdown, &in_lookup);}
static void IN_LookdownUp(void) {KeyUp(&in_lookdown);}
static void IN_MoveleftDown(void) {KeyDown(&in_moveleft, &in_moveright);}
static void IN_MoveleftUp(void) {KeyUp(&in_moveleft);}
static void IN_MoverightDown(void) {KeyDown(&in_moveright, &in_moveleft);}
static void IN_MoverightUp(void) {KeyUp(&in_moveright);}
static void IN_RollLeftDown(void) {KeyDown(&in_rollleft, &in_rollright);}
static void IN_RollLeftUp(void) {KeyUp(&in_rollleft);}
static void IN_RollRightDown(void) {KeyDown(&in_rollright, &in_rollleft);}
static void IN_RollRightUp(void) {KeyUp(&in_rollright);}
static void IN_SpeedDown(void) {KeyDown(&in_speed, NULL);}
static void IN_SpeedUp(void) {KeyUp(&in_speed);}
static void IN_StrafeDown(void) {KeyDown(&in_strafe, NULL);}
static void IN_StrafeUp(void) {KeyUp(&in_strafe);}
static void IN_AttackDown(void) {IN_DoPostSelect(); KeyDown(&in_attack, NULL);}
static void IN_AttackUp(void) {if (KeyUp(&in_attack)) IN_DoWeaponHide();}
static void IN_UseDown (void) {KeyDown(&in_use, NULL);}
static void IN_UseUp (void) {KeyUp(&in_use);}
static void IN_JumpDown (void)
{
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
qboolean up;
int pnum = CL_TargettedSplit(false);
playerview_t *pv = &cl.playerview[pnum];
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
up = (cls.state == ca_active && cl_smartjump.ival && !prox_inmenu.ival);
if (!up)
up = false;
#ifdef Q2CLIENT
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
else if (cls.protocol == CP_QUAKE2)
up = true; //always smartjump in q2.
#endif
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
else if (pv->spectator && pv->cam_state != CAM_FREECAM)
up = false; //if we're tracking, don't confuse stuff.
#ifdef QUAKESTATS
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
else if (!pv->spectator && pv->stats[STAT_HEALTH] <= 0)
up = false; //don't ever 'swim' when dead.
else if (pv->pmovetype == PM_FLY || pv->pmovetype == PM_6DOF || pv->pmovetype == PM_SPECTATOR || pv->pmovetype == PM_OLD_SPECTATOR)
up = true; //fling/spectating
else if ((pv->pmovetype == PM_NORMAL || pv->pmovetype == PM_WALLWALK) && pv->waterlevel >= 2 && (!cl.teamfortress || !(in_forward.state[pnum] & 1)))
up = true; //swimming. TF only (silently) smartjumps when NOT moving.
#endif
else
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
up = false;
KeyDown((up?&in_up:&in_jump), &in_down);
}
static void IN_JumpUp (void)
{
if (cl_smartjump.ival)
KeyUp(&in_up);
KeyUp(&in_jump);
}
static void IN_ButtonNDown(void) {KeyDown(&in_button[atoi(Cmd_Argv(0)+7)], NULL);}
static void IN_ButtonNUp(void) {KeyUp(&in_button[atoi(Cmd_Argv(0)+7)]);}
float in_rotate;
static void IN_Rotate_f (void) {in_rotate += atoi(Cmd_Argv(1));}
void IN_WriteButtons(vfsfile_t *f, qboolean all)
{
int s,b;
struct
{
kbutton_t *button;
char *name;
} buttons [] =
{
{&in_mlook, "mlook"},
{&in_klook, "klook"},
{&in_left, "left"},
{&in_right, "right"},
{&in_forward, "forward"},
{&in_back, "back"},
{&in_lookup, "lookup"},
{&in_lookdown, "lookdown"},
{&in_moveleft, "moveleft"},
{&in_moveright, "moveright"},
{&in_strafe, "strafe"},
{&in_speed, "speed"},
{&in_use, "use"},
{&in_jump, "jump"},
{&in_attack, "attack"},
{&in_rollleft, "rollleft"},
{&in_rollright, "rollright"},
{&in_up, "up"},
{&in_down, "down"},
};
s = 0;
VFS_PRINTF(f, "\n//Player 1 buttons\n");
for (b = 0; b < countof(buttons); b++)
{
if ((buttons[b].button->state[s]&1) && (buttons[b].button->down[s][0]==-1 || buttons[b].button->down[s][1]==-1))
VFS_PRINTF(f, "+%s\n", buttons[b].name);
else if (b || all)
VFS_PRINTF(f, "-%s\n", buttons[b].name);
}
for (b = 0; b < countof(in_button); b++)
{
if ((in_button[b].state[s]&1) && (in_button[b].down[s][0]==-1 || in_button[b].down[s][1]==-1))
VFS_PRINTF(f, "+button%i\n", b);
else
VFS_PRINTF(f, "-button%i\n", b);
}
for (s = 1; s < MAX_SPLITS; s++)
{
VFS_PRINTF(f, "\n//Player %i buttons\n", s);
for (b = 0; b < countof(buttons); b++)
{
if ((buttons[b].button->state[s]&1) && (buttons[b].button->down[s][0]==-1 || buttons[b].button->down[s][1]==-1))
VFS_PRINTF(f, "+p%i %s\n", s, buttons[b].name);
else if (b || all)
VFS_PRINTF(f, "-p%i %s\n", s, buttons[b].name);
}
for (b = 0; b < countof(in_button); b++)
{
if ((in_button[b].state[s]&1) && (in_button[b].down[s][0]==-1 || in_button[b].down[s][1]==-1))
VFS_PRINTF(f, "+p%i button%i\n", s, b);
else
VFS_PRINTF(f, "-p%i button%i\n", s, b);
}
}
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
//FIXME: save device remappings to config.
}
//This function incorporates Tonik's impulse 8 7 6 5 4 3 2 1 to select the prefered weapon on the basis of having it.
//It also incorporates split screen input as well as impulse buffering
void IN_Impulse (void)
{
int newimp;
int pnum = CL_TargettedSplit(false);
newimp = Q_atoi(Cmd_Argv(1));
#ifdef QUAKESTATS
if (Cmd_Argc() > 2)
{
int best = IN_BestWeapon_Args(pnum, 1, Cmd_Argc() - 1);
if (best)
newimp = best;
}
#endif
CL_QueueImpulse(pnum, newimp);
}
void IN_Restart (void)
{
IN_Shutdown();
IN_ReInit();
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
//FIXME: re-assert explicit device re-mappings
}
/*
===============
CL_KeyState
Returns 0.25 if a key was pressed and released during the frame,
0.5 if it was pressed and held
0 if held then released, and
1.0 if held for the entire time
===============
*/
float CL_KeyState (kbutton_t *key, int pnum, qboolean noslowstart)
{
float val;
qboolean impulsedown, impulseup, down;
noslowstart = noslowstart && cl_fastaccel.ival;
impulsedown = key->state[pnum] & 2;
impulseup = key->state[pnum] & 4;
down = key->state[pnum] & 1;
val = 0;
if (impulsedown && !impulseup)
{
if (down)
val = noslowstart?1.0:0.5; // pressed and held this frame
else
val = 0; // I_Error ();
}
if (impulseup && !impulsedown)
{
if (down)
val = 0; // I_Error ();
else
val = 0; // released this frame
}
if (!impulsedown && !impulseup)
{
if (down)
val = 1.0; // held the entire frame
else
val = 0; // up the entire frame
}
if (impulsedown && impulseup)
{
if (down)
val = 0.75; // released and re-pressed this frame
else
val = 0.25; // pressed and released this frame
}
key->state[pnum] &= 1; // clear impulses
return val;
}
void CL_ProxyMenuHook(char *command, kbutton_t *key)
{
if ((key->state[0] & 3) == 3) //2 is impulse down, 1 is held down
{
key->state[0] = 0; // clear impulses
Cbuf_AddText(command, RESTRICT_DEFAULT);
}
}
void CL_ProxyMenuHooks(void)
{
if (!prox_inmenu.ival)
return;
CL_ProxyMenuHook("say proxy:menu down\n", &in_back);
CL_ProxyMenuHook("say proxy:menu up\n", &in_forward);
CL_ProxyMenuHook("say proxy:menu left\n", &in_left);
CL_ProxyMenuHook("say proxy:menu right\n", &in_right);
CL_ProxyMenuHook("say proxy:menu left\n", &in_moveleft);
CL_ProxyMenuHook("say proxy:menu right\n", &in_moveright);
CL_ProxyMenuHook("say proxy:menu use\n", &in_jump);
}
//==========================================================================
cvar_t cl_upspeed = CVARF("cl_upspeed","400", CVAR_ARCHIVE);
cvar_t cl_forwardspeed = CVARF("cl_forwardspeed","400", CVAR_ARCHIVE);
cvar_t cl_backspeed = CVARFD("cl_backspeed","", CVAR_ARCHIVE, "The base speed that you move backwards at. If empty, uses the value of cl_forwardspeed instead.");
cvar_t cl_sidespeed = CVARF("cl_sidespeed","400", CVAR_ARCHIVE);
cvar_t cl_movespeedkey = CVAR("cl_movespeedkey","2.0");
cvar_t cl_yawspeed = CVAR("cl_yawspeed","140");
cvar_t cl_pitchspeed = CVAR("cl_pitchspeed","150");
cvar_t cl_anglespeedkey = CVAR("cl_anglespeedkey","1.5");
#define GATHERBIT(bname,bit) if (bname.state[pnum] & 3) {bits |= (1u<<(bit));} bname.state[pnum] &= ~2;
#define UNUSEDBUTTON(bnum) if (in_button[bnum].state[pnum] & 3) {Con_Printf("+button%i is not supported on this protocol\n", pnum); } in_button[bnum].state[pnum] &= ~3;
void CL_GatherButtons (usercmd_t *cmd, int pnum)
{
unsigned int bits = 0;
GATHERBIT(in_attack, 0);
#ifdef Q3CLIENT
if (cls.protocol==CP_QUAKE3)
{ //quake3's buttons are nice and simple, buttonN -> bit|=(1<<N)
int i;
for (i = 0; i < countof(in_button); i++)
{
GATHERBIT(in_button[i], i);
}
// bits |= 1<<1; //rtcw talking
// bits |= 1<<4; //rtcw walking
// bits |= 1<<7; //rtcw any key
cmd->buttons = bits;
return;
}
#endif
//quakec's numbered buttons make no sense and have no sane relation to bit numbers
GATHERBIT(in_button[0], 0);
UNUSEDBUTTON(1); //officially, qc's button1 field is unusable (although qw folds button3 over to it)
GATHERBIT(in_button[2], 1); GATHERBIT(in_jump, 1);
GATHERBIT(in_button[3], 2);
GATHERBIT(in_button[4], 3);
GATHERBIT(in_button[5], 4);
GATHERBIT(in_button[6], 5);
GATHERBIT(in_button[7], 6);
GATHERBIT(in_button[8], 7);
openxr plugin: tweaked - inputs should be working properly now, and are visible to csqc. subject to further breaking changes, however. _pext_vrinputs: added cvar to enable vr inputs protocol extension allowing vr inputs to be networked to ssqc too. defaults to 0 for now, will be renamed when deemed final. updates menu: the prompt to enable sources is now more explicit instead of expecting the user to have a clue. updates menu: added a v3 sources format, which should be more maintainable. not final. updates menu: try to give reasons why sources might be failing (to help blame ISPs if they try fucking over TTH dns again). presets menu: no longer closes the instant a preset is chosen. some presets have a couple of modifiers listed. force the demo loop in the background to serve as a preview. prompts menus: now does word wrapping. ftemaster: support importing server lists from other master servers (requested by Eukara). server: try to detect when non-reply inbound packets are blocked by firewalls/nats/etc (using ftemaster to do so). qcvm: added pointcontentsmask builtin, allowing it to probe more than just world, with fte's full contentbit range instead of just q1 legacy. qcvm: memfill8 builtin now works on createbuffer() pointers. qcvm: add missing unsigned ops. Fixed double comparison ops. fixed bug with op_store_i64. added missing OP_LOADP_I64 qcc: added '#pragma framerate RATE' for overriding implicit nextthink durations. qcc: fixed '#pragma DONT_COMPILE_THIS_FILE' to not screw up comments. qcc: added __GITURL__ __GITHASH__ __GITDATE__ __GITDATETIME__ __GITDESC__ for any mods that might want to make use of that. qcc: fix up -Fhashonly a little setrenderer: support for vulkan gpu enumeration. rulesets: reworked to support custom rulesets (using hashes to catch haxxors, though still nothing prevents just changing the client to ignore rulesets) bspx: use our BIH code for the bspx BRUSHLIST lump instead of the older less efficient code. (static)iqm+obj: these model formats can now be used for the worldmodel (with a suitable .ent file). Also using BIH for much better collision performance. pmove: tried to optimise PM_NudgePosition, should boost fps in stress tests. wayland: fix a crash on startup. mousegrabs now works better. imagetool: uses sdl for previews. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5813 fc73d0e0-1445-4013-8a0c-d673dee63da5
2021-04-14 06:21:04 +01:00
//more inconsistencies, as required for dpcompat.
GATHERBIT(in_use, (cls.protocol==CP_QUAKEWORLD)?4:8);
openxr plugin: tweaked - inputs should be working properly now, and are visible to csqc. subject to further breaking changes, however. _pext_vrinputs: added cvar to enable vr inputs protocol extension allowing vr inputs to be networked to ssqc too. defaults to 0 for now, will be renamed when deemed final. updates menu: the prompt to enable sources is now more explicit instead of expecting the user to have a clue. updates menu: added a v3 sources format, which should be more maintainable. not final. updates menu: try to give reasons why sources might be failing (to help blame ISPs if they try fucking over TTH dns again). presets menu: no longer closes the instant a preset is chosen. some presets have a couple of modifiers listed. force the demo loop in the background to serve as a preview. prompts menus: now does word wrapping. ftemaster: support importing server lists from other master servers (requested by Eukara). server: try to detect when non-reply inbound packets are blocked by firewalls/nats/etc (using ftemaster to do so). qcvm: added pointcontentsmask builtin, allowing it to probe more than just world, with fte's full contentbit range instead of just q1 legacy. qcvm: memfill8 builtin now works on createbuffer() pointers. qcvm: add missing unsigned ops. Fixed double comparison ops. fixed bug with op_store_i64. added missing OP_LOADP_I64 qcc: added '#pragma framerate RATE' for overriding implicit nextthink durations. qcc: fixed '#pragma DONT_COMPILE_THIS_FILE' to not screw up comments. qcc: added __GITURL__ __GITHASH__ __GITDATE__ __GITDATETIME__ __GITDESC__ for any mods that might want to make use of that. qcc: fix up -Fhashonly a little setrenderer: support for vulkan gpu enumeration. rulesets: reworked to support custom rulesets (using hashes to catch haxxors, though still nothing prevents just changing the client to ignore rulesets) bspx: use our BIH code for the bspx BRUSHLIST lump instead of the older less efficient code. (static)iqm+obj: these model formats can now be used for the worldmodel (with a suitable .ent file). Also using BIH for much better collision performance. pmove: tried to optimise PM_NudgePosition, should boost fps in stress tests. wayland: fix a crash on startup. mousegrabs now works better. imagetool: uses sdl for previews. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5813 fc73d0e0-1445-4013-8a0c-d673dee63da5
2021-04-14 06:21:04 +01:00
bits |= (Key_Dest_Has(~kdm_game)) ?(1u<<9):0; //'buttonchat'. game is the lowest priority, anything else will take focus away. we consider that to mean 'chat' (although it could be menus).
bits |= (cursor_active) ?(1u<<10):0; //'cursor_active'. prydon cursor stuff.
GATHERBIT(in_button[9], 11);
GATHERBIT(in_button[10], 12);
GATHERBIT(in_button[11], 13);
GATHERBIT(in_button[12], 14);
GATHERBIT(in_button[13], 15);
GATHERBIT(in_button[14], 16);
GATHERBIT(in_button[15], 17);
GATHERBIT(in_button[16], 18);
UNUSEDBUTTON(17);
UNUSEDBUTTON(18);
UNUSEDBUTTON(19);
// UNUSEDBUTTON(20);
openxr plugin: tweaked - inputs should be working properly now, and are visible to csqc. subject to further breaking changes, however. _pext_vrinputs: added cvar to enable vr inputs protocol extension allowing vr inputs to be networked to ssqc too. defaults to 0 for now, will be renamed when deemed final. updates menu: the prompt to enable sources is now more explicit instead of expecting the user to have a clue. updates menu: added a v3 sources format, which should be more maintainable. not final. updates menu: try to give reasons why sources might be failing (to help blame ISPs if they try fucking over TTH dns again). presets menu: no longer closes the instant a preset is chosen. some presets have a couple of modifiers listed. force the demo loop in the background to serve as a preview. prompts menus: now does word wrapping. ftemaster: support importing server lists from other master servers (requested by Eukara). server: try to detect when non-reply inbound packets are blocked by firewalls/nats/etc (using ftemaster to do so). qcvm: added pointcontentsmask builtin, allowing it to probe more than just world, with fte's full contentbit range instead of just q1 legacy. qcvm: memfill8 builtin now works on createbuffer() pointers. qcvm: add missing unsigned ops. Fixed double comparison ops. fixed bug with op_store_i64. added missing OP_LOADP_I64 qcc: added '#pragma framerate RATE' for overriding implicit nextthink durations. qcc: fixed '#pragma DONT_COMPILE_THIS_FILE' to not screw up comments. qcc: added __GITURL__ __GITHASH__ __GITDATE__ __GITDATETIME__ __GITDESC__ for any mods that might want to make use of that. qcc: fix up -Fhashonly a little setrenderer: support for vulkan gpu enumeration. rulesets: reworked to support custom rulesets (using hashes to catch haxxors, though still nothing prevents just changing the client to ignore rulesets) bspx: use our BIH code for the bspx BRUSHLIST lump instead of the older less efficient code. (static)iqm+obj: these model formats can now be used for the worldmodel (with a suitable .ent file). Also using BIH for much better collision performance. pmove: tried to optimise PM_NudgePosition, should boost fps in stress tests. wayland: fix a crash on startup. mousegrabs now works better. imagetool: uses sdl for previews. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5813 fc73d0e0-1445-4013-8a0c-d673dee63da5
2021-04-14 06:21:04 +01:00
//NQ protocol:
//bit 30 means input_weapon field is sent. figured out at time of sending.
//bit 31 means input_cursor* fields are sent. figured out at time of sending.
cmd->buttons |= bits;
}
void CL_ClearPendingCommands(void)
{
size_t seat, i;
memset(&cl_pendingcmd, 0, sizeof(cl_pendingcmd));
for (seat = 0; seat < countof(cl_pendingcmd); seat++)
{
for (i=0 ; i<3 ; i++)
cl_pendingcmd[seat].angles[i] = ((int)(cl.playerview[seat].viewangles[i]*65536.0/360)&65535);
}
}
/*
================
CL_AdjustAngles
Moves the local angle positions
================
*/
void CL_AdjustAngles (int pnum, double frametime)
{
float speed, quant;
float up, down;
if (in_speed.state[pnum] & 1)
{
if (ruleset_allow_frj.ival)
speed = cl_anglespeedkey.value;
else
speed = bound(-2, cl_anglespeedkey.value, 2);
}
else
speed = 1;
if (in_rotate && pnum==0 && !(cl.fpd & FPD_LIMIT_YAW))
{
quant = in_rotate;
if (!cl_instantrotate.ival)
quant *= speed*frametime;
in_rotate -= quant;
if (ruleset_allow_frj.ival)
cl.playerview[pnum].viewanglechange[YAW] += quant;
}
if (!(in_strafe.state[pnum] & 1))
{
quant = cl_yawspeed.value*speed;
if ((cl.fpd & FPD_LIMIT_YAW) || !ruleset_allow_frj.ival)
quant = bound(-900, quant, 900);
quant *= frametime;
cl.playerview[pnum].viewanglechange[YAW] -= quant * CL_KeyState (&in_right, pnum, false);
cl.playerview[pnum].viewanglechange[YAW] += quant * CL_KeyState (&in_left, pnum, false);
}
if (in_klook.state[pnum] & 1)
{
V_StopPitchDrift (&cl.playerview[pnum]);
quant = cl_pitchspeed.value*speed;
if ((cl.fpd & FPD_LIMIT_PITCH) || !ruleset_allow_frj.ival)
quant = bound(-700, quant, 700);
quant *= frametime;
cl.playerview[pnum].viewanglechange[PITCH] -= quant * CL_KeyState (&in_forward, pnum, false);
cl.playerview[pnum].viewanglechange[PITCH] += quant * CL_KeyState (&in_back, pnum, false);
}
quant = cl_rollspeed.value*speed;
quant *= frametime;
cl.playerview[pnum].viewanglechange[ROLL] -= quant * CL_KeyState (&in_rollleft, pnum, false);
cl.playerview[pnum].viewanglechange[ROLL] += quant * CL_KeyState (&in_rollright, pnum, false);
up = CL_KeyState (&in_lookup, pnum, false);
down = CL_KeyState(&in_lookdown, pnum, false);
quant = cl_pitchspeed.value*speed;
if ((cl.fpd & FPD_LIMIT_PITCH) || !ruleset_allow_frj.ival)
quant = bound(-700, quant, 700);
quant *= frametime;
cl.playerview[pnum].viewanglechange[PITCH] -= quant * up;
cl.playerview[pnum].viewanglechange[PITCH] += quant * down;
if (up || down)
V_StopPitchDrift (&cl.playerview[pnum]);
}
/*
================
CL_BaseMove
Send the intended movement message to the server
================
*/
void CL_BaseMove (usercmd_t *cmd, int pnum, float priortime, float extratime)
{
float nscale = extratime?extratime / (extratime+priortime):0;
float oscale = 1 - nscale;
openxr plugin: tweaked - inputs should be working properly now, and are visible to csqc. subject to further breaking changes, however. _pext_vrinputs: added cvar to enable vr inputs protocol extension allowing vr inputs to be networked to ssqc too. defaults to 0 for now, will be renamed when deemed final. updates menu: the prompt to enable sources is now more explicit instead of expecting the user to have a clue. updates menu: added a v3 sources format, which should be more maintainable. not final. updates menu: try to give reasons why sources might be failing (to help blame ISPs if they try fucking over TTH dns again). presets menu: no longer closes the instant a preset is chosen. some presets have a couple of modifiers listed. force the demo loop in the background to serve as a preview. prompts menus: now does word wrapping. ftemaster: support importing server lists from other master servers (requested by Eukara). server: try to detect when non-reply inbound packets are blocked by firewalls/nats/etc (using ftemaster to do so). qcvm: added pointcontentsmask builtin, allowing it to probe more than just world, with fte's full contentbit range instead of just q1 legacy. qcvm: memfill8 builtin now works on createbuffer() pointers. qcvm: add missing unsigned ops. Fixed double comparison ops. fixed bug with op_store_i64. added missing OP_LOADP_I64 qcc: added '#pragma framerate RATE' for overriding implicit nextthink durations. qcc: fixed '#pragma DONT_COMPILE_THIS_FILE' to not screw up comments. qcc: added __GITURL__ __GITHASH__ __GITDATE__ __GITDATETIME__ __GITDESC__ for any mods that might want to make use of that. qcc: fix up -Fhashonly a little setrenderer: support for vulkan gpu enumeration. rulesets: reworked to support custom rulesets (using hashes to catch haxxors, though still nothing prevents just changing the client to ignore rulesets) bspx: use our BIH code for the bspx BRUSHLIST lump instead of the older less efficient code. (static)iqm+obj: these model formats can now be used for the worldmodel (with a suitable .ent file). Also using BIH for much better collision performance. pmove: tried to optimise PM_NudgePosition, should boost fps in stress tests. wayland: fix a crash on startup. mousegrabs now works better. imagetool: uses sdl for previews. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5813 fc73d0e0-1445-4013-8a0c-d673dee63da5
2021-04-14 06:21:04 +01:00
cmd->fservertime = cl.time*1000;
cmd->servertime = cl.time*1000;
//
// adjust for speed key
//
if ((in_speed.state[pnum] & 1) ^ cl_run.ival)
nscale *= cl_movespeedkey.value;
if (in_strafe.state[pnum] & 1)
cmd->sidemove = cmd->sidemove*oscale + nscale*cl_sidespeed.value * (CL_KeyState (&in_right, pnum, true) - CL_KeyState (&in_left, pnum, true)) * (in_xflip.ival?-1:1);
cmd->sidemove = cmd->sidemove*oscale + nscale*cl_sidespeed.value * (CL_KeyState (&in_moveright, pnum, true) - CL_KeyState (&in_moveleft, pnum, true)) * (in_xflip.ival?-1:1);
cmd->upmove = cmd->upmove*oscale + nscale*cl_upspeed.value * (CL_KeyState (&in_up, pnum, true) - CL_KeyState (&in_down, pnum, true));
if (! (in_klook.state[pnum] & 1) )
{
cmd->forwardmove = cmd->forwardmove*oscale + nscale*(cl_forwardspeed.value * CL_KeyState (&in_forward, pnum, true) -
(*cl_backspeed.string?cl_backspeed.value:cl_forwardspeed.value) * CL_KeyState (&in_back, pnum, true));
}
if (!priortime) //only gather buttons if we've not had any this frame. this avoids jump feeling weird with prediction. FIXME: should probably still allow +attack to reduce latency
CL_GatherButtons(cmd, pnum);
}
static void CL_ClampPitch (int pnum, float frametime)
{
float mat[16];
float roll;
playerview_t *pv = &cl.playerview[pnum];
if (cl.intermissionmode != IM_NONE)
{
memset(pv->viewanglechange, 0, sizeof(pv->viewanglechange));
return;
}
if (pv->pmovetype == PM_6DOF)
{
// vec3_t impact;
// vec3_t norm;
float mat2[16];
// vec3_t cross;
vec3_t view[4];
// float dot;
AngleVectors(pv->viewangles, view[0], view[1], view[2]);
Matrix4x4_RM_FromVectors(mat, view[0], view[1], view[2], vec3_origin);
Matrix4_Multiply(Matrix4x4_CM_NewRotation(-pv->viewanglechange[PITCH], 0, 1, 0), mat, mat2);
Matrix4_Multiply(Matrix4x4_CM_NewRotation(pv->viewanglechange[YAW], 0, 0, 1), mat2, mat);
#if 1
//roll angles
Matrix4_Multiply(Matrix4x4_CM_NewRotation(pv->viewanglechange[ROLL], 1, 0, 0), mat, mat2);
#else
//auto-roll
Matrix3x4_RM_ToVectors(mat, view[0], view[1], view[2], view[3]);
VectorMA(pv->simorg, -48, view[2], view[3]);
if (!TraceLineN(pv->simorg, view[3], impact, norm))
{
norm[0] = 0;
norm[1] = 0;
norm[2] = 1;
}
/*keep the roll relative to the 'ground'*/
CrossProduct(norm, view[2], cross);
dot = DotProduct(view[0], cross);
roll = timestep * 360 * -(dot);
Matrix4_Multiply(Matrix4x4_CM_NewRotation(roll, 1, 0, 0), mat, mat2);
#endif
Matrix3x4_RM_ToVectors(mat2, view[0], view[1], view[2], view[3]);
added r_meshpitch cvar that allows for fixing the unfixable mesh pitch bug from vanilla... needs a better name... do note that this will break pretty much any mod, so this is really only for TCs designed to use it. Its likely that I missed places. nqsv: added support for spectators with nq clients. the angles are a bit rough, but hey. need to do something about frags so nq clients know who's a spectator. use 'cmd observe' to get an nq client to spectate on an fte server (then attack/jump behave the same as in qw clients). nqsv: rewrote EF_MUZZLEFLASH handling, so svc_muzzleflash is now translated properly to EF_MUZZLEFLASH, and vice versa. No more missing muzzleflashes! added screenshot_cubemap, so you can actually pre-generate cubemaps with fte (which can be used for reflections or whatever). misc fixes (server crash, a couple of other less important ones). external files based on a model's name will now obey r_replacemodels properly, instead of needing to use foo.mdl_0.skin for foo.md3. identify <playernum> should now use the correct masked ip, instead of abrubtly failing (reported by kt) vid_toggle console command should now obey vid_width and vid_height when switching to fullscreen, but only if vid_fullscreen is actually set, which should make it seem better behaved (reported by kt). qcc: cleaned up sym->symboldata[sym->ofs] to be more consistent at all stages. qcc: typedef float vec4[4]; now works to define a float array with 4 elements (however, it will be passed by-value rather than by-reference). qcc: cleaned up optional vs __out ordering issues. qccgui: shift+f3 searches backwards git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5064 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-02-27 09:34:35 +00:00
VectorAngles(view[0], view[2], pv->viewangles, false);
VectorClear(pv->viewanglechange);
return;
}
#if 1
if ((pv->gravitydir[2] != -1 || pv->viewangles[2]))
{
float surfm[16], invsurfm[16];
float viewm[16];
vec3_t view[4];
vec3_t surf[3];
vec3_t vang;
void PerpendicularVector( vec3_t dst, const vec3_t src );
/*calc current view matrix relative to the surface*/
AngleVectors(pv->viewangles, view[0], view[1], view[2]);
VectorNegate(view[1], view[1]);
/*calculate the surface axis with up from the pmove code and right/forwards relative to the player's directions*/
if (!pv->gravitydir[0] && !pv->gravitydir[1] && !pv->gravitydir[2])
{
VectorSet(surf[2], 0, 0, 1);
}
else
{
VectorNegate(pv->gravitydir, surf[2]);
}
VectorNormalize(surf[2]);
PerpendicularVector(surf[1], surf[2]);
VectorNormalize(surf[1]);
CrossProduct(surf[2], surf[1], surf[0]);
VectorNegate(surf[0], surf[0]);
VectorNormalize(surf[0]);
Matrix4x4_RM_FromVectors(surfm, surf[0], surf[1], surf[2], vec3_origin);
Matrix3x4_InvertTo4x4_Simple(surfm, invsurfm);
/*calc current view matrix relative to the surface*/
Matrix4x4_RM_FromVectors(viewm, view[0], view[1], view[2], vec3_origin);
Matrix4_Multiply(viewm, invsurfm, mat);
/*convert that back to angles*/
Matrix3x4_RM_ToVectors(mat, view[0], view[1], view[2], view[3]);
added r_meshpitch cvar that allows for fixing the unfixable mesh pitch bug from vanilla... needs a better name... do note that this will break pretty much any mod, so this is really only for TCs designed to use it. Its likely that I missed places. nqsv: added support for spectators with nq clients. the angles are a bit rough, but hey. need to do something about frags so nq clients know who's a spectator. use 'cmd observe' to get an nq client to spectate on an fte server (then attack/jump behave the same as in qw clients). nqsv: rewrote EF_MUZZLEFLASH handling, so svc_muzzleflash is now translated properly to EF_MUZZLEFLASH, and vice versa. No more missing muzzleflashes! added screenshot_cubemap, so you can actually pre-generate cubemaps with fte (which can be used for reflections or whatever). misc fixes (server crash, a couple of other less important ones). external files based on a model's name will now obey r_replacemodels properly, instead of needing to use foo.mdl_0.skin for foo.md3. identify <playernum> should now use the correct masked ip, instead of abrubtly failing (reported by kt) vid_toggle console command should now obey vid_width and vid_height when switching to fullscreen, but only if vid_fullscreen is actually set, which should make it seem better behaved (reported by kt). qcc: cleaned up sym->symboldata[sym->ofs] to be more consistent at all stages. qcc: typedef float vec4[4]; now works to define a float array with 4 elements (however, it will be passed by-value rather than by-reference). qcc: cleaned up optional vs __out ordering issues. qccgui: shift+f3 searches backwards git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5064 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-02-27 09:34:35 +00:00
VectorAngles(view[0], view[2], vang, false);
/*edit it*/
vang[PITCH] += pv->viewanglechange[PITCH];
vang[YAW] += pv->viewanglechange[YAW];
if (vang[PITCH] <= -180)
vang[PITCH] += 360;
if (vang[PITCH] > 180)
vang[PITCH] -= 360;
if (vang[ROLL] >= 180)
vang[ROLL] -= 360;
if (vang[ROLL] < -180)
vang[ROLL] += 360;
/*keep the player looking relative to their ground (smoothlyish)*/
if (!vang[ROLL])
{
if (!pv->viewanglechange[PITCH] && !pv->viewanglechange[YAW] && !pv->viewanglechange[ROLL])
return;
}
else
{
if (fabs(vang[ROLL]) < frametime*180)
vang[ROLL] = 0;
else if (vang[ROLL] > 0)
{
// Con_Printf("Roll %f\n", vang[ROLL]);
vang[ROLL] -= frametime*180;
}
else
{
// Con_Printf("Roll %f\n", vang[ROLL]);
vang[ROLL] += frametime*180;
}
}
VectorClear(pv->viewanglechange);
/*clamp pitch*/
if (vang[PITCH] > cl.maxpitch)
vang[PITCH] = cl.maxpitch;
if (vang[PITCH] < cl.minpitch)
vang[PITCH] = cl.minpitch;
/*turn those angles back to a matrix*/
AngleVectors(vang, view[0], view[1], view[2]);
VectorNegate(view[1], view[1]);
Matrix4x4_RM_FromVectors(mat, view[0], view[1], view[2], vec3_origin);
/*rotate back into world space*/
Matrix4_Multiply(mat, surfm, viewm);
/*and figure out the final result*/
Matrix3x4_RM_ToVectors(viewm, view[0], view[1], view[2], view[3]);
added r_meshpitch cvar that allows for fixing the unfixable mesh pitch bug from vanilla... needs a better name... do note that this will break pretty much any mod, so this is really only for TCs designed to use it. Its likely that I missed places. nqsv: added support for spectators with nq clients. the angles are a bit rough, but hey. need to do something about frags so nq clients know who's a spectator. use 'cmd observe' to get an nq client to spectate on an fte server (then attack/jump behave the same as in qw clients). nqsv: rewrote EF_MUZZLEFLASH handling, so svc_muzzleflash is now translated properly to EF_MUZZLEFLASH, and vice versa. No more missing muzzleflashes! added screenshot_cubemap, so you can actually pre-generate cubemaps with fte (which can be used for reflections or whatever). misc fixes (server crash, a couple of other less important ones). external files based on a model's name will now obey r_replacemodels properly, instead of needing to use foo.mdl_0.skin for foo.md3. identify <playernum> should now use the correct masked ip, instead of abrubtly failing (reported by kt) vid_toggle console command should now obey vid_width and vid_height when switching to fullscreen, but only if vid_fullscreen is actually set, which should make it seem better behaved (reported by kt). qcc: cleaned up sym->symboldata[sym->ofs] to be more consistent at all stages. qcc: typedef float vec4[4]; now works to define a float array with 4 elements (however, it will be passed by-value rather than by-reference). qcc: cleaned up optional vs __out ordering issues. qccgui: shift+f3 searches backwards git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5064 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-02-27 09:34:35 +00:00
VectorAngles(view[0], view[2], cl.playerview[pnum].viewangles, false);
if (pv->viewangles[ROLL] >= 360)
pv->viewangles[ROLL] -= 360;
if (pv->viewangles[ROLL] < 0)
pv->viewangles[ROLL] += 360;
if (pv->viewangles[PITCH] < -180)
pv->viewangles[PITCH] += 360;
return;
}
#endif
pv->viewangles[PITCH] += pv->viewanglechange[PITCH];
pv->viewangles[YAW] += pv->viewanglechange[YAW];
pv->viewangles[ROLL] += pv->viewanglechange[ROLL];
Reworked client support for DPP5+. less code now, its much more graceful. added waterfog command. waterfog overrides regular fog only when the view is in water. fixed 64bit printf format specifiers. should work better on winxp64. fixed some spec angle weirdness. fixed viewsize 99.99 weirdness with ezhud. fixed extra offset on the console (exhibited in 64bit builds, but not limited to). fixed .avi playback, can now actually display frames again. reimplemented line sparks. fixed r_editlights_save flipping the light's pitch. fixed issue with oggs failing to load. fixed condump to cope with unicode properly. made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision. fixed nq server to not stall weirdly on map changes. fixed qwprogs svc_cdtrack not bugging out with nq clients on the server. fixed restart command to load the last map run by the server, instead of start.bsp (when idle) optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now. fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised). fixed a couple of bugs from font change. also now supports utf-8 in a few more places. r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little). fixed so corona-only lights won't generate shadowmaps and waste lots of time. removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet. fixed nested calls with variant-vectors. this fixes csaddon's light editor. fixed qcc hc calling conventions using redundant stores. disabled keywords can still be used by using __keyword instead. fixed ftegccgui grep feature. fixed motionless-dog qcc bug. tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings. fixed qw svc_intermission + dpp5+ clients bug. fixed annoying spam about disconnecting in hexen2. rewrote status command a little to cope with ipv6 addresses more gracefully fixed significant stall when hibernating/debugging a server with a player sitting on it. fixed truelightning. fixed rocketlight overriding pflags. fixed torches vanishing on vid_restart. fixed issue with decal scaling. fixed findentityfield builtin. fixed fteqcc issue with ptr+1 fixed use of arrays inside class functions. fixed/implemented fteqcc emulation of pointer opcodes. added __inout keyword to fteqcc, so that it doesn't feel so horrendous. fixed sizeof(*foo) fixed *struct = struct; fixed recursive structs. fixed fteqcc warning report. fixed sdl2 controller support, hopefully. attempted to implement xinput, including per-player audio playback. slightly fixed relaxed attitude to mouse focus when running fullscreen. fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors. implemented bindmaps (for csqc). fixed crashing bug with eprint builtin. implemented subset of music_playlist_* functionality. significant changes to music playback. fixed some more dpcsqc compat. fixed binds menu. now displays and accepts modifiers. fixed issues with huge lightmaps. fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests. implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh. implemented sv_saveentfile command. fixed resume after breaking inside a stepped-over function. fixed erroneous footer after debugging. (I wonder just how many things I broke with these fixes) git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 11:56:18 +01:00
pv->viewangles[YAW] /= 360;
pv->viewangles[YAW] = pv->viewangles[YAW] - (int)pv->viewangles[YAW];
pv->viewangles[YAW] *= 360;
VectorClear(pv->viewanglechange);
#ifdef Q2CLIENT
if (cls.protocol == CP_QUAKE2)
{
float pitch;
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
pitch = SHORT2ANGLE(cl.q2frame.playerstate[pnum].pmove.delta_angles[PITCH]);
if (pitch > 180)
pitch -= 360;
if (pv->viewangles[PITCH] + pitch < -360)
pv->viewangles[PITCH] += 360; // wrapped
if (pv->viewangles[PITCH] + pitch > 360)
pv->viewangles[PITCH] -= 360; // wrapped
if (pv->viewangles[PITCH] + pitch > cl.maxpitch)
pv->viewangles[PITCH] = cl.maxpitch - pitch;
if (pv->viewangles[PITCH] + pitch < cl.minpitch)
pv->viewangles[PITCH] = cl.minpitch - pitch;
}
else
#endif
#ifdef Q3CLIENT
if (cls.protocol == CP_QUAKE3) //q3 expects the cgame to do it
{
//no-op
}
else
#endif
{
if (pv->viewangles[PITCH] > cl.maxpitch)
pv->viewangles[PITCH] = cl.maxpitch;
if (pv->viewangles[PITCH] < cl.minpitch)
pv->viewangles[PITCH] = cl.minpitch;
}
// if (cl.viewangles[pnum][ROLL] > 50)
// cl.viewangles[pnum][ROLL] = 50;
// if (cl.viewangles[pnum][ROLL] < -50)
// cl.viewangles[pnum][ROLL] = -50;
roll = frametime*pv->viewangles[ROLL]*30;
if ((pv->viewangles[ROLL]-roll < 0) != (pv->viewangles[ROLL]<0))
pv->viewangles[ROLL] = 0;
else
pv->viewangles[ROLL] -= frametime*pv->viewangles[ROLL]*3;
}
/*
==============
CL_FinishMove
==============
*/
static void CL_FinishMove (usercmd_t *cmd, int pnum)
{
int i;
CL_ClampPitch(pnum, 0);
//
// always dump the first two message, because it may contain leftover inputs
// from the last level
//
if (cl.movesequence <= 2)
{
cmd->buttons = 0;
return;
}
//
// figure button bits
//
CL_GatherButtons(cmd, pnum);
for (i=0 ; i<3 ; i++)
cmd->angles[i] = ((int)(cl.playerview[pnum].viewangles[i]*65536.0/360)&65535);
if (in_impulsespending[pnum] && !cl.paused)
{
cmd->impulse = in_impulse[pnum][(in_nextimpulse[pnum])%IN_IMPULSECACHE];
in_nextimpulse[pnum]++;
in_impulsespending[pnum]--;
}
else
cmd->impulse = 0;
}
void CL_UpdatePrydonCursor(usercmd_t *from, int pnum)
{
int hit;
vec3_t cursor_end;
vec3_t temp;
vec3_t cursor_impact_normal;
cursor_active = true;
if (!cl_prydoncursor.ival)
{ //center the cursor
from->cursor_screen[0] = 0;
from->cursor_screen[1] = 0;
}
else
{
from->cursor_screen[0] = mousecursor_x/(vid.width/2.0f) - 1;
from->cursor_screen[1] = mousecursor_y/(vid.height/2.0f) - 1;
if (from->cursor_screen[0] < -1)
from->cursor_screen[0] = -1;
if (from->cursor_screen[1] < -1)
from->cursor_screen[1] = -1;
if (from->cursor_screen[0] > 1)
from->cursor_screen[0] = 1;
if (from->cursor_screen[1] > 1)
from->cursor_screen[1] = 1;
}
/*
if (cl.cmd.cursor_screen[0] < -1)
{
cl.viewangles[YAW] -= m_yaw.value * (cl.cmd.cursor_screen[0] - -1) * vid.realwidth * sensitivity.value * cl.viewzoom;
cl.cmd.cursor_screen[0] = -1;
}
if (cl.cmd.cursor_screen[0] > 1)
{
cl.viewangles[YAW] -= m_yaw.value * (cl.cmd.cursor_screen[0] - 1) * vid.realwidth * sensitivity.value * cl.viewzoom;
cl.cmd.cursor_screen[0] = 1;
}
if (cl.cmd.cursor_screen[1] < -1)
{
cl.viewangles[PITCH] += m_pitch.value * (cl.cmd.cursor_screen[1] - -1) * vid.realheight * sensitivity.value * cl.viewzoom;
cl.cmd.cursor_screen[1] = -1;
}
if (cl.cmd.cursor_screen[1] > 1)
{
cl.viewangles[PITCH] += m_pitch.value * (cl.cmd.cursor_screen[1] - 1) * vid.realheight * sensitivity.value * cl.viewzoom;
cl.cmd.cursor_screen[1] = 1;
}
*/
VectorClear(from->cursor_start);
temp[0] = (from->cursor_screen[0]+1)/2;
temp[1] = (-from->cursor_screen[1]+1)/2;
temp[2] = 1;
VectorCopy(r_origin, from->cursor_start);
Matrix4x4_CM_UnProject(temp, cursor_end, cl.playerview[pnum].viewangles, from->cursor_start, r_refdef.fov_x, r_refdef.fov_y);
CL_SetSolidEntities();
//don't bother with players, they don't exist in NQ...
CL_TraceLine(from->cursor_start, cursor_end, from->cursor_impact, cursor_impact_normal, &hit);
if (hit>0)
from->cursor_entitynumber = hit;
else if (hit < 0)
from->cursor_entitynumber = 0; //FIXME: ask csqc for the entity's entnum
else
from->cursor_entitynumber = 0;
// P_RunParticleEffect(cursor_impact, vec3_origin, 15, 16);
}
#ifdef NQPROT
void CLNQ_SendMove (usercmd_t *cmd, int pnum, sizebuf_t *buf)
{
int i;
openxr plugin: tweaked - inputs should be working properly now, and are visible to csqc. subject to further breaking changes, however. _pext_vrinputs: added cvar to enable vr inputs protocol extension allowing vr inputs to be networked to ssqc too. defaults to 0 for now, will be renamed when deemed final. updates menu: the prompt to enable sources is now more explicit instead of expecting the user to have a clue. updates menu: added a v3 sources format, which should be more maintainable. not final. updates menu: try to give reasons why sources might be failing (to help blame ISPs if they try fucking over TTH dns again). presets menu: no longer closes the instant a preset is chosen. some presets have a couple of modifiers listed. force the demo loop in the background to serve as a preview. prompts menus: now does word wrapping. ftemaster: support importing server lists from other master servers (requested by Eukara). server: try to detect when non-reply inbound packets are blocked by firewalls/nats/etc (using ftemaster to do so). qcvm: added pointcontentsmask builtin, allowing it to probe more than just world, with fte's full contentbit range instead of just q1 legacy. qcvm: memfill8 builtin now works on createbuffer() pointers. qcvm: add missing unsigned ops. Fixed double comparison ops. fixed bug with op_store_i64. added missing OP_LOADP_I64 qcc: added '#pragma framerate RATE' for overriding implicit nextthink durations. qcc: fixed '#pragma DONT_COMPILE_THIS_FILE' to not screw up comments. qcc: added __GITURL__ __GITHASH__ __GITDATE__ __GITDATETIME__ __GITDESC__ for any mods that might want to make use of that. qcc: fix up -Fhashonly a little setrenderer: support for vulkan gpu enumeration. rulesets: reworked to support custom rulesets (using hashes to catch haxxors, though still nothing prevents just changing the client to ignore rulesets) bspx: use our BIH code for the bspx BRUSHLIST lump instead of the older less efficient code. (static)iqm+obj: these model formats can now be used for the worldmodel (with a suitable .ent file). Also using BIH for much better collision performance. pmove: tried to optimise PM_NudgePosition, should boost fps in stress tests. wayland: fix a crash on startup. mousegrabs now works better. imagetool: uses sdl for previews. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5813 fc73d0e0-1445-4013-8a0c-d673dee63da5
2021-04-14 06:21:04 +01:00
unsigned int bits;
if (cls.demoplayback!=DPB_NONE)
return; //err... don't bother... :)
//
// always dump the first two message, because it may contain leftover inputs
// from the last level
//
if (cl.movesequence <= 2 || cls.state == ca_connected)
{
MSG_WriteByte (buf, clc_nop);
return;
}
MSG_WriteByte (buf, clc_move);
if (cls.protocol_nq >= CPNQ_DP7)
{
if (!cl_movement.ival)
MSG_WriteLong(buf, 0);
else
MSG_WriteLong(buf, cl.movesequence);
}
else if (cls.fteprotocolextensions2 & PEXT2_PREDINFO)
MSG_WriteShort(buf, cl.movesequence&0xffff);
openxr plugin: tweaked - inputs should be working properly now, and are visible to csqc. subject to further breaking changes, however. _pext_vrinputs: added cvar to enable vr inputs protocol extension allowing vr inputs to be networked to ssqc too. defaults to 0 for now, will be renamed when deemed final. updates menu: the prompt to enable sources is now more explicit instead of expecting the user to have a clue. updates menu: added a v3 sources format, which should be more maintainable. not final. updates menu: try to give reasons why sources might be failing (to help blame ISPs if they try fucking over TTH dns again). presets menu: no longer closes the instant a preset is chosen. some presets have a couple of modifiers listed. force the demo loop in the background to serve as a preview. prompts menus: now does word wrapping. ftemaster: support importing server lists from other master servers (requested by Eukara). server: try to detect when non-reply inbound packets are blocked by firewalls/nats/etc (using ftemaster to do so). qcvm: added pointcontentsmask builtin, allowing it to probe more than just world, with fte's full contentbit range instead of just q1 legacy. qcvm: memfill8 builtin now works on createbuffer() pointers. qcvm: add missing unsigned ops. Fixed double comparison ops. fixed bug with op_store_i64. added missing OP_LOADP_I64 qcc: added '#pragma framerate RATE' for overriding implicit nextthink durations. qcc: fixed '#pragma DONT_COMPILE_THIS_FILE' to not screw up comments. qcc: added __GITURL__ __GITHASH__ __GITDATE__ __GITDATETIME__ __GITDESC__ for any mods that might want to make use of that. qcc: fix up -Fhashonly a little setrenderer: support for vulkan gpu enumeration. rulesets: reworked to support custom rulesets (using hashes to catch haxxors, though still nothing prevents just changing the client to ignore rulesets) bspx: use our BIH code for the bspx BRUSHLIST lump instead of the older less efficient code. (static)iqm+obj: these model formats can now be used for the worldmodel (with a suitable .ent file). Also using BIH for much better collision performance. pmove: tried to optimise PM_NudgePosition, should boost fps in stress tests. wayland: fix a crash on startup. mousegrabs now works better. imagetool: uses sdl for previews. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5813 fc73d0e0-1445-4013-8a0c-d673dee63da5
2021-04-14 06:21:04 +01:00
if (cls.fteprotocolextensions2 & PEXT2_VRINPUTS)
MSGFTE_WriteDeltaUsercmd(buf, &nullcmd, cmd);
else
{
openxr plugin: tweaked - inputs should be working properly now, and are visible to csqc. subject to further breaking changes, however. _pext_vrinputs: added cvar to enable vr inputs protocol extension allowing vr inputs to be networked to ssqc too. defaults to 0 for now, will be renamed when deemed final. updates menu: the prompt to enable sources is now more explicit instead of expecting the user to have a clue. updates menu: added a v3 sources format, which should be more maintainable. not final. updates menu: try to give reasons why sources might be failing (to help blame ISPs if they try fucking over TTH dns again). presets menu: no longer closes the instant a preset is chosen. some presets have a couple of modifiers listed. force the demo loop in the background to serve as a preview. prompts menus: now does word wrapping. ftemaster: support importing server lists from other master servers (requested by Eukara). server: try to detect when non-reply inbound packets are blocked by firewalls/nats/etc (using ftemaster to do so). qcvm: added pointcontentsmask builtin, allowing it to probe more than just world, with fte's full contentbit range instead of just q1 legacy. qcvm: memfill8 builtin now works on createbuffer() pointers. qcvm: add missing unsigned ops. Fixed double comparison ops. fixed bug with op_store_i64. added missing OP_LOADP_I64 qcc: added '#pragma framerate RATE' for overriding implicit nextthink durations. qcc: fixed '#pragma DONT_COMPILE_THIS_FILE' to not screw up comments. qcc: added __GITURL__ __GITHASH__ __GITDATE__ __GITDATETIME__ __GITDESC__ for any mods that might want to make use of that. qcc: fix up -Fhashonly a little setrenderer: support for vulkan gpu enumeration. rulesets: reworked to support custom rulesets (using hashes to catch haxxors, though still nothing prevents just changing the client to ignore rulesets) bspx: use our BIH code for the bspx BRUSHLIST lump instead of the older less efficient code. (static)iqm+obj: these model formats can now be used for the worldmodel (with a suitable .ent file). Also using BIH for much better collision performance. pmove: tried to optimise PM_NudgePosition, should boost fps in stress tests. wayland: fix a crash on startup. mousegrabs now works better. imagetool: uses sdl for previews. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5813 fc73d0e0-1445-4013-8a0c-d673dee63da5
2021-04-14 06:21:04 +01:00
MSG_WriteFloat (buf, cmd->fservertime); // use latest time. because ping reports!
for (i=0 ; i<3 ; i++)
{
openxr plugin: tweaked - inputs should be working properly now, and are visible to csqc. subject to further breaking changes, however. _pext_vrinputs: added cvar to enable vr inputs protocol extension allowing vr inputs to be networked to ssqc too. defaults to 0 for now, will be renamed when deemed final. updates menu: the prompt to enable sources is now more explicit instead of expecting the user to have a clue. updates menu: added a v3 sources format, which should be more maintainable. not final. updates menu: try to give reasons why sources might be failing (to help blame ISPs if they try fucking over TTH dns again). presets menu: no longer closes the instant a preset is chosen. some presets have a couple of modifiers listed. force the demo loop in the background to serve as a preview. prompts menus: now does word wrapping. ftemaster: support importing server lists from other master servers (requested by Eukara). server: try to detect when non-reply inbound packets are blocked by firewalls/nats/etc (using ftemaster to do so). qcvm: added pointcontentsmask builtin, allowing it to probe more than just world, with fte's full contentbit range instead of just q1 legacy. qcvm: memfill8 builtin now works on createbuffer() pointers. qcvm: add missing unsigned ops. Fixed double comparison ops. fixed bug with op_store_i64. added missing OP_LOADP_I64 qcc: added '#pragma framerate RATE' for overriding implicit nextthink durations. qcc: fixed '#pragma DONT_COMPILE_THIS_FILE' to not screw up comments. qcc: added __GITURL__ __GITHASH__ __GITDATE__ __GITDATETIME__ __GITDESC__ for any mods that might want to make use of that. qcc: fix up -Fhashonly a little setrenderer: support for vulkan gpu enumeration. rulesets: reworked to support custom rulesets (using hashes to catch haxxors, though still nothing prevents just changing the client to ignore rulesets) bspx: use our BIH code for the bspx BRUSHLIST lump instead of the older less efficient code. (static)iqm+obj: these model formats can now be used for the worldmodel (with a suitable .ent file). Also using BIH for much better collision performance. pmove: tried to optimise PM_NudgePosition, should boost fps in stress tests. wayland: fix a crash on startup. mousegrabs now works better. imagetool: uses sdl for previews. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5813 fc73d0e0-1445-4013-8a0c-d673dee63da5
2021-04-14 06:21:04 +01:00
if (cls.protocol_nq == CPNQ_FITZ666 || (cls.proquake_angles_hack && buf->prim.anglesize <= 1))
{
//fitz/proquake protocols are always 16bit for this angle and 8bit elsewhere. rmq is always at least 16bit
//the above logic should satify everything.
MSG_WriteAngle16 (buf, cl.playerview[pnum].viewangles[i]);
}
else
MSG_WriteAngle (buf, cl.playerview[pnum].viewangles[i]);
}
openxr plugin: tweaked - inputs should be working properly now, and are visible to csqc. subject to further breaking changes, however. _pext_vrinputs: added cvar to enable vr inputs protocol extension allowing vr inputs to be networked to ssqc too. defaults to 0 for now, will be renamed when deemed final. updates menu: the prompt to enable sources is now more explicit instead of expecting the user to have a clue. updates menu: added a v3 sources format, which should be more maintainable. not final. updates menu: try to give reasons why sources might be failing (to help blame ISPs if they try fucking over TTH dns again). presets menu: no longer closes the instant a preset is chosen. some presets have a couple of modifiers listed. force the demo loop in the background to serve as a preview. prompts menus: now does word wrapping. ftemaster: support importing server lists from other master servers (requested by Eukara). server: try to detect when non-reply inbound packets are blocked by firewalls/nats/etc (using ftemaster to do so). qcvm: added pointcontentsmask builtin, allowing it to probe more than just world, with fte's full contentbit range instead of just q1 legacy. qcvm: memfill8 builtin now works on createbuffer() pointers. qcvm: add missing unsigned ops. Fixed double comparison ops. fixed bug with op_store_i64. added missing OP_LOADP_I64 qcc: added '#pragma framerate RATE' for overriding implicit nextthink durations. qcc: fixed '#pragma DONT_COMPILE_THIS_FILE' to not screw up comments. qcc: added __GITURL__ __GITHASH__ __GITDATE__ __GITDATETIME__ __GITDESC__ for any mods that might want to make use of that. qcc: fix up -Fhashonly a little setrenderer: support for vulkan gpu enumeration. rulesets: reworked to support custom rulesets (using hashes to catch haxxors, though still nothing prevents just changing the client to ignore rulesets) bspx: use our BIH code for the bspx BRUSHLIST lump instead of the older less efficient code. (static)iqm+obj: these model formats can now be used for the worldmodel (with a suitable .ent file). Also using BIH for much better collision performance. pmove: tried to optimise PM_NudgePosition, should boost fps in stress tests. wayland: fix a crash on startup. mousegrabs now works better. imagetool: uses sdl for previews. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5813 fc73d0e0-1445-4013-8a0c-d673dee63da5
2021-04-14 06:21:04 +01:00
MSG_WriteShort (buf, cmd->forwardmove);
MSG_WriteShort (buf, cmd->sidemove);
MSG_WriteShort (buf, cmd->upmove);
bits = cmd->buttons;
if (cls.fteprotocolextensions2 & PEXT2_PRYDONCURSOR)
{
if (cmd->cursor_screen[0] || cmd->cursor_screen[1] ||
cmd->cursor_start[0] || cmd->cursor_start[1] || cmd->cursor_start[2] ||
cmd->cursor_impact[0] || cmd->cursor_impact[1] || cmd->cursor_impact[2] ||
cmd->cursor_entitynumber)
bits |= (1u<<31); //set it if there's actually something to send.
MSG_WriteLong (buf, bits);
}
else if (cls.protocol_nq >= CPNQ_DP6)
{
MSG_WriteLong (buf, bits);
bits |= (1u<<31); //unconditionally set it (without writing it)
}
else
MSG_WriteByte (buf, cmd->buttons);
MSG_WriteByte (buf, cmd->impulse);
openxr plugin: tweaked - inputs should be working properly now, and are visible to csqc. subject to further breaking changes, however. _pext_vrinputs: added cvar to enable vr inputs protocol extension allowing vr inputs to be networked to ssqc too. defaults to 0 for now, will be renamed when deemed final. updates menu: the prompt to enable sources is now more explicit instead of expecting the user to have a clue. updates menu: added a v3 sources format, which should be more maintainable. not final. updates menu: try to give reasons why sources might be failing (to help blame ISPs if they try fucking over TTH dns again). presets menu: no longer closes the instant a preset is chosen. some presets have a couple of modifiers listed. force the demo loop in the background to serve as a preview. prompts menus: now does word wrapping. ftemaster: support importing server lists from other master servers (requested by Eukara). server: try to detect when non-reply inbound packets are blocked by firewalls/nats/etc (using ftemaster to do so). qcvm: added pointcontentsmask builtin, allowing it to probe more than just world, with fte's full contentbit range instead of just q1 legacy. qcvm: memfill8 builtin now works on createbuffer() pointers. qcvm: add missing unsigned ops. Fixed double comparison ops. fixed bug with op_store_i64. added missing OP_LOADP_I64 qcc: added '#pragma framerate RATE' for overriding implicit nextthink durations. qcc: fixed '#pragma DONT_COMPILE_THIS_FILE' to not screw up comments. qcc: added __GITURL__ __GITHASH__ __GITDATE__ __GITDATETIME__ __GITDESC__ for any mods that might want to make use of that. qcc: fix up -Fhashonly a little setrenderer: support for vulkan gpu enumeration. rulesets: reworked to support custom rulesets (using hashes to catch haxxors, though still nothing prevents just changing the client to ignore rulesets) bspx: use our BIH code for the bspx BRUSHLIST lump instead of the older less efficient code. (static)iqm+obj: these model formats can now be used for the worldmodel (with a suitable .ent file). Also using BIH for much better collision performance. pmove: tried to optimise PM_NudgePosition, should boost fps in stress tests. wayland: fix a crash on startup. mousegrabs now works better. imagetool: uses sdl for previews. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5813 fc73d0e0-1445-4013-8a0c-d673dee63da5
2021-04-14 06:21:04 +01:00
if (bits & (1u<<31))
{
MSG_WriteShort (buf, cmd->cursor_screen[0] * 32767.0f);
MSG_WriteShort (buf, cmd->cursor_screen[1] * 32767.0f);
MSG_WriteFloat (buf, cmd->cursor_start[0]);
MSG_WriteFloat (buf, cmd->cursor_start[1]);
MSG_WriteFloat (buf, cmd->cursor_start[2]);
MSG_WriteFloat (buf, cmd->cursor_impact[0]);
MSG_WriteFloat (buf, cmd->cursor_impact[1]);
MSG_WriteFloat (buf, cmd->cursor_impact[2]);
MSG_WriteEntity (buf, cmd->cursor_entitynumber);
}
}
}
void QDECL Name_Callback(struct cvar_s *var, char *oldvalue)
{
if (cls.state <= ca_connected)
return;
if (cls.protocol != CP_NETQUAKE)
return;
CL_SendClientCommand(true, "name \"%s\"\n", var->string);
}
void CLNQ_SendCmd(sizebuf_t *buf)
{
int i;
int seat;
usercmd_t *cmd;
i = cl.movesequence & UPDATE_MASK;
cl.outframes[i].senttime = realtime;
cl.outframes[i].latency = -1;
cl.outframes[i].server_message_num = cl.validsequence;
cl.outframes[i].cmd_sequence = cl.movesequence;
cl.outframes[i].sentgametime = cl.movesequence_time;
for (seat = 0; seat < cl.splitclients; seat++)
{
cmd = &cl.outframes[i].cmd[seat];
*cmd = cl_pendingcmd[seat];
cmd->fservertime = cl.movesequence_time;
// cmd->msec = (cl.time - cl.outframes[(i-1)&UPDATE_MASK].sentgametime)*1000;
#ifdef CSQC_DAT
CSQC_Input_Frame(seat, cmd);
#endif
}
CL_ClearPendingCommands();
//inputs are only sent once we receive an entity.
if (cls.signon == 4)
{
for (seat = 0; seat < cl.splitclients; seat++)
{
// send the unreliable message
// if (independantphysics[seat].impulse && !cls.netchan.message.cursize)
// CLNQ_SendMove (&cl.outframes[i].cmd[seat], seat, &cls.netchan.message);
// else
CLNQ_SendMove (&cl.outframes[i].cmd[seat], seat, buf);
}
}
else
MSG_WriteByte (buf, clc_nop);
for (i = 0; i < cl.numackframes; i++)
{
MSG_WriteByte(buf, clcdp_ackframe);
MSG_WriteLong(buf, cl.ackframes[i]);
}
cl.numackframes = 0;
}
#else
void Name_Callback(struct cvar_s *var, char *oldvalue)
{
}
#endif
float CL_FilterTime (double time, float wantfps, float limit, qboolean ignoreserver) //now returns the extra time not taken in this slot. Note that negative 1 means uncapped.
{
float fps, fpscap;
if (cls.timedemo)
return -1;
if (cls.protocol == CP_QUAKE3)
ignoreserver = true;
/*ignore the server if we're playing demos, sending to the server only as replies, or if its meant to be disabled (netfps depending on where its called from)*/
if (cls.demoplayback != DPB_NONE || (cls.protocol != CP_QUAKEWORLD && cls.protocol != CP_NETQUAKE) || ignoreserver)
{
if (!wantfps)
return -1;
fps = max (1.0, wantfps);
}
else
{
fpscap = cls.maxfps ? max (30.0, cls.maxfps) : 0x7fff;
#ifdef IRCCONNECT
if (cls.netchan.remote_address.type == NA_IRC)
fps = bound (0.1, wantfps, fpscap); //if we're connected via irc, allow a greatly reduced minimum cap
else
#endif
if (wantfps < 1)
fps = fpscap;
else
fps = bound (6.7, wantfps, fpscap); //we actually cap ourselves to 150msecs (1000/7 = 142)
}
//its not time yet
if (time < ceil(1000 / fps))
return 0;
//clamp it if we have over 1.5 frame banked somehow
if (limit && time - (1000 / fps) > (1000 / fps)*limit)
return (1000 / fps) * limit;
//report how much spare time the caller now has
return time - (1000 / fps);
}
typedef struct clcmdbuf_s {
struct clcmdbuf_s *next;
int len;
qboolean reliable;
char command[4]; //this is dynamically allocated, so this is variably sized.
} clcmdbuf_t;
clcmdbuf_t *clientcmdlist;
void VARGS CL_SendClientCommand(qboolean reliable, char *format, ...)
{
qboolean oldallow;
va_list argptr;
char string[2048];
clcmdbuf_t *buf, *prev;
if (cls.demoplayback && cls.demoplayback != DPB_EZTV)
return; //no point.
va_start (argptr, format);
Q_vsnprintfz (string,sizeof(string), format,argptr);
va_end (argptr);
#ifdef Q3CLIENT
if (cls.protocol == CP_QUAKE3)
{
CLQ3_SendClientCommand("%s", string);
return;
}
#endif
oldallow = CL_AllowIndependantSendCmd(false);
buf = Z_Malloc(sizeof(*buf)+strlen(string));
strcpy(buf->command, string);
buf->len = strlen(buf->command);
buf->reliable = reliable;
//add to end of the list so that the first of the list is the first to be sent.
if (!clientcmdlist)
clientcmdlist = buf;
else
{
for (prev = clientcmdlist; prev->next; prev=prev->next)
;
prev->next = buf;
}
CL_AllowIndependantSendCmd(oldallow);
}
//sometimes a server will quickly restart twice.
//connected clients will then receive TWO 'new' commands - both with the same servercount value.
//the connection process then tries to proceed with two sets of commands until it fails catastrophically.
//by attempting to strip out dupe commands we can usually avoid the issue
//note that FTE servers track progress properly, so this is not an issue for us, but in the interests of compat with mvdsv...
//however, FTE servers can send a little faster, so warnings about this can be awkward.
int CL_RemoveClientCommands(char *command)
{
clcmdbuf_t *next, *first;
int removed = 0;
int len = strlen(command);
CL_AllowIndependantSendCmd(false);
if (!clientcmdlist)
return 0;
while(!strncmp(clientcmdlist->command, command, len))
{
next = clientcmdlist->next;
Z_Free(clientcmdlist);
clientcmdlist=next;
removed++;
if (!clientcmdlist)
return removed;
}
first = clientcmdlist;
while(first->next)
{
if (!strncmp(first->next->command, command, len))
{
next = first->next->next;
Z_Free(first->next);
first->next = next;
removed++;
}
else
first = first->next;
}
return removed;
}
void CL_FlushClientCommands(void)
{
clcmdbuf_t *next;
CL_AllowIndependantSendCmd(false);
while(clientcmdlist)
{
Con_DPrintf("Flushed command %s\n", clientcmdlist->command);
next = clientcmdlist->next;
Z_Free(clientcmdlist);
clientcmdlist=next;
}
}
qboolean runningindepphys;
#ifdef MULTITHREAD
void *indeplock;
void *indepthread;
qboolean allowindepphys;
qboolean CL_AllowIndependantSendCmd(qboolean allow)
{
qboolean ret = allowindepphys;
if (!runningindepphys)
return ret;
if (allowindepphys != allow && runningindepphys)
{
if (allow)
Sys_UnlockMutex(indeplock);
else
Sys_LockMutex(indeplock);
allowindepphys = allow;
}
return ret;
}
int CL_IndepPhysicsThread(void *param)
{
double sleeptime;
double fps;
double time, lasttime;
double spare;
lasttime = Sys_DoubleTime();
while(runningindepphys)
{
time = Sys_DoubleTime();
spare = CL_FilterTime((time - lasttime)*1000, cl_netfps.value, 1.5, false);
if (spare)
{
time -= spare/1000.0f;
Sys_LockMutex(indeplock);
if (cls.state)
CL_SendCmd(time - lasttime, false);
lasttime = time;
Sys_UnlockMutex(indeplock);
}
fps = cl_netfps.value;
if (fps < 4)
fps = 4;
while (fps < 100)
fps*=2;
sleeptime = 1/fps;
Sys_Sleep(sleeptime);
}
return 0;
}
void CL_UseIndepPhysics(qboolean allow)
{
if (runningindepphys == allow)
return;
if (allow)
{ //enable it
indeplock = Sys_CreateMutex();
runningindepphys = true;
indepthread = Sys_CreateThread("indepphys", CL_IndepPhysicsThread, NULL, THREADP_HIGHEST, 8192);
allowindepphys = true;
}
else
{
CL_AllowIndependantSendCmd(true);
//shut it down.
runningindepphys = false; //tell thread to exit gracefully
Sys_WaitOnThread(indepthread);
indepthread = NULL;
Sys_DestroyMutex(indeplock);
indeplock = NULL;
}
}
#else
qboolean CL_AllowIndependantSendCmd(qboolean allow)
{
return false;
}
void CL_UseIndepPhysics(qboolean allow)
{
}
#endif
static void QDECL CL_SpareMsec_Callback (struct cvar_s *var, char *oldvalue)
{
if (var->value > 50)
{
Cvar_ForceSet(var, "50");
return;
}
else if (var->value < 0)
{
Cvar_ForceSet(var, "0");
return;
}
}
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
void CL_UpdateSeats(void)
{
if (!cls.netchan.message.cursize && cl.allocated_client_slots > 1 && cls.state == ca_active && cl.splitclients && (cls.fteprotocolextensions & PEXT_SPLITSCREEN) && cl.worldmodel)
{
int targ = cl_splitscreen.ival+1;
if (targ > MAX_SPLITS)
targ = MAX_SPLITS;
if (cl.splitclients < targ)
{
char *ver;
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
char buffer[2048];
char infostr[2048];
infobuf_t *info = &cls.userinfo[cl.splitclients];
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
//some userinfos should always have a value
if (!*InfoBuf_ValueForKey(info, "name")) //$name-2
InfoBuf_SetKey(info, "name", va("%s-%i\n", InfoBuf_ValueForKey(&cls.userinfo[0], "name"), cl.splitclients+1));
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 (cls.protocol != CP_QUAKE2)
{
if (!*InfoBuf_ValueForKey(info, "team")) //put players on the same team by default. this avoids team damage in coop, and if you're playing on the same computer then you probably want to be on the same team anyway.
InfoBuf_SetKey(info, "team", InfoBuf_ValueForKey(&cls.userinfo[0], "team"));
if (!*InfoBuf_ValueForKey(info, "bottomcolor")) //bottom colour implies team in nq
InfoBuf_SetKey(info, "bottomcolor", InfoBuf_ValueForKey(&cls.userinfo[0], "bottomcolor"));
if (!*InfoBuf_ValueForKey(info, "topcolor")) //should probably pick a random top colour or something
InfoBuf_SetKey(info, "topcolor", InfoBuf_ValueForKey(&cls.userinfo[0], "topcolor"));
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 (!*InfoBuf_ValueForKey(info, "skin")) //give players the same skin by default, because we can. q2 cares for teams. qw might as well (its not like anyone actually uses them thanks to enemy-skin forcing).
InfoBuf_SetKey(info, "skin", InfoBuf_ValueForKey(&cls.userinfo[0], "skin"));
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
#ifdef SVNREVISION
if (strcmp(STRINGIFY(SVNREVISION), "-"))
ver = va("%s v%i.%02i %s", DISTRIBUTION, FTE_VER_MAJOR, FTE_VER_MINOR, STRINGIFY(SVNREVISION));
else
#endif
ver = va("%s v%i.%02i", DISTRIBUTION, FTE_VER_MAJOR, FTE_VER_MINOR);
InfoBuf_SetStarKey(info, "*ver", ver);
InfoBuf_ToString(info, infostr, sizeof(infostr), NULL, NULL, NULL, &cls.userinfosync, info);
CL_SendClientCommand(true, "addseat %i %s", cl.splitclients, COM_QuotedString(infostr, buffer, sizeof(buffer), false));
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
}
else if (cl.splitclients > targ && targ >= 1)
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
CL_SendClientCommand(true, "addseat %i", targ);
}
}
/*
=================
CL_SendCmd
=================
*/
vec3_t accum[MAX_SPLITS];
qboolean CL_WriteDeltas (int plnum, sizebuf_t *buf)
{
int i;
usercmd_t *cmd, *oldcmd;
qboolean dontdrop = false;
i = (cls.netchan.outgoing_sequence-2) & UPDATE_MASK;
cmd = &cl.outframes[i].cmd[plnum];
if (cl_c2sImpulseBackup.ival >= 2)
dontdrop = dontdrop || cmd->impulse;
openxr plugin: tweaked - inputs should be working properly now, and are visible to csqc. subject to further breaking changes, however. _pext_vrinputs: added cvar to enable vr inputs protocol extension allowing vr inputs to be networked to ssqc too. defaults to 0 for now, will be renamed when deemed final. updates menu: the prompt to enable sources is now more explicit instead of expecting the user to have a clue. updates menu: added a v3 sources format, which should be more maintainable. not final. updates menu: try to give reasons why sources might be failing (to help blame ISPs if they try fucking over TTH dns again). presets menu: no longer closes the instant a preset is chosen. some presets have a couple of modifiers listed. force the demo loop in the background to serve as a preview. prompts menus: now does word wrapping. ftemaster: support importing server lists from other master servers (requested by Eukara). server: try to detect when non-reply inbound packets are blocked by firewalls/nats/etc (using ftemaster to do so). qcvm: added pointcontentsmask builtin, allowing it to probe more than just world, with fte's full contentbit range instead of just q1 legacy. qcvm: memfill8 builtin now works on createbuffer() pointers. qcvm: add missing unsigned ops. Fixed double comparison ops. fixed bug with op_store_i64. added missing OP_LOADP_I64 qcc: added '#pragma framerate RATE' for overriding implicit nextthink durations. qcc: fixed '#pragma DONT_COMPILE_THIS_FILE' to not screw up comments. qcc: added __GITURL__ __GITHASH__ __GITDATE__ __GITDATETIME__ __GITDESC__ for any mods that might want to make use of that. qcc: fix up -Fhashonly a little setrenderer: support for vulkan gpu enumeration. rulesets: reworked to support custom rulesets (using hashes to catch haxxors, though still nothing prevents just changing the client to ignore rulesets) bspx: use our BIH code for the bspx BRUSHLIST lump instead of the older less efficient code. (static)iqm+obj: these model formats can now be used for the worldmodel (with a suitable .ent file). Also using BIH for much better collision performance. pmove: tried to optimise PM_NudgePosition, should boost fps in stress tests. wayland: fix a crash on startup. mousegrabs now works better. imagetool: uses sdl for previews. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5813 fc73d0e0-1445-4013-8a0c-d673dee63da5
2021-04-14 06:21:04 +01:00
MSGCL_WriteDeltaUsercmd (buf, &nullcmd, cmd);
oldcmd = cmd;
i = (cls.netchan.outgoing_sequence-1) & UPDATE_MASK;
if (cl_c2sImpulseBackup.ival >= 3)
dontdrop = dontdrop || cmd->impulse;
cmd = &cl.outframes[i].cmd[plnum];
openxr plugin: tweaked - inputs should be working properly now, and are visible to csqc. subject to further breaking changes, however. _pext_vrinputs: added cvar to enable vr inputs protocol extension allowing vr inputs to be networked to ssqc too. defaults to 0 for now, will be renamed when deemed final. updates menu: the prompt to enable sources is now more explicit instead of expecting the user to have a clue. updates menu: added a v3 sources format, which should be more maintainable. not final. updates menu: try to give reasons why sources might be failing (to help blame ISPs if they try fucking over TTH dns again). presets menu: no longer closes the instant a preset is chosen. some presets have a couple of modifiers listed. force the demo loop in the background to serve as a preview. prompts menus: now does word wrapping. ftemaster: support importing server lists from other master servers (requested by Eukara). server: try to detect when non-reply inbound packets are blocked by firewalls/nats/etc (using ftemaster to do so). qcvm: added pointcontentsmask builtin, allowing it to probe more than just world, with fte's full contentbit range instead of just q1 legacy. qcvm: memfill8 builtin now works on createbuffer() pointers. qcvm: add missing unsigned ops. Fixed double comparison ops. fixed bug with op_store_i64. added missing OP_LOADP_I64 qcc: added '#pragma framerate RATE' for overriding implicit nextthink durations. qcc: fixed '#pragma DONT_COMPILE_THIS_FILE' to not screw up comments. qcc: added __GITURL__ __GITHASH__ __GITDATE__ __GITDATETIME__ __GITDESC__ for any mods that might want to make use of that. qcc: fix up -Fhashonly a little setrenderer: support for vulkan gpu enumeration. rulesets: reworked to support custom rulesets (using hashes to catch haxxors, though still nothing prevents just changing the client to ignore rulesets) bspx: use our BIH code for the bspx BRUSHLIST lump instead of the older less efficient code. (static)iqm+obj: these model formats can now be used for the worldmodel (with a suitable .ent file). Also using BIH for much better collision performance. pmove: tried to optimise PM_NudgePosition, should boost fps in stress tests. wayland: fix a crash on startup. mousegrabs now works better. imagetool: uses sdl for previews. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5813 fc73d0e0-1445-4013-8a0c-d673dee63da5
2021-04-14 06:21:04 +01:00
MSGCL_WriteDeltaUsercmd (buf, oldcmd, cmd);
oldcmd = cmd;
i = (cls.netchan.outgoing_sequence) & UPDATE_MASK;
if (cl_c2sImpulseBackup.ival >= 1)
dontdrop = dontdrop || cmd->impulse;
cmd = &cl.outframes[i].cmd[plnum];
openxr plugin: tweaked - inputs should be working properly now, and are visible to csqc. subject to further breaking changes, however. _pext_vrinputs: added cvar to enable vr inputs protocol extension allowing vr inputs to be networked to ssqc too. defaults to 0 for now, will be renamed when deemed final. updates menu: the prompt to enable sources is now more explicit instead of expecting the user to have a clue. updates menu: added a v3 sources format, which should be more maintainable. not final. updates menu: try to give reasons why sources might be failing (to help blame ISPs if they try fucking over TTH dns again). presets menu: no longer closes the instant a preset is chosen. some presets have a couple of modifiers listed. force the demo loop in the background to serve as a preview. prompts menus: now does word wrapping. ftemaster: support importing server lists from other master servers (requested by Eukara). server: try to detect when non-reply inbound packets are blocked by firewalls/nats/etc (using ftemaster to do so). qcvm: added pointcontentsmask builtin, allowing it to probe more than just world, with fte's full contentbit range instead of just q1 legacy. qcvm: memfill8 builtin now works on createbuffer() pointers. qcvm: add missing unsigned ops. Fixed double comparison ops. fixed bug with op_store_i64. added missing OP_LOADP_I64 qcc: added '#pragma framerate RATE' for overriding implicit nextthink durations. qcc: fixed '#pragma DONT_COMPILE_THIS_FILE' to not screw up comments. qcc: added __GITURL__ __GITHASH__ __GITDATE__ __GITDATETIME__ __GITDESC__ for any mods that might want to make use of that. qcc: fix up -Fhashonly a little setrenderer: support for vulkan gpu enumeration. rulesets: reworked to support custom rulesets (using hashes to catch haxxors, though still nothing prevents just changing the client to ignore rulesets) bspx: use our BIH code for the bspx BRUSHLIST lump instead of the older less efficient code. (static)iqm+obj: these model formats can now be used for the worldmodel (with a suitable .ent file). Also using BIH for much better collision performance. pmove: tried to optimise PM_NudgePosition, should boost fps in stress tests. wayland: fix a crash on startup. mousegrabs now works better. imagetool: uses sdl for previews. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5813 fc73d0e0-1445-4013-8a0c-d673dee63da5
2021-04-14 06:21:04 +01:00
MSGCL_WriteDeltaUsercmd (buf, oldcmd, cmd);
return dontdrop;
}
#ifdef Q2CLIENT
qboolean CLQ2_SendCmd (sizebuf_t *buf)
{
int seq_hash;
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
qboolean dontdrop = false;
usercmd_t *cmd;
int checksumIndex, i;
int lightlev;
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
int seat;
cl.movesequence = cls.netchan.outgoing_sequence; //make sure its correct even over map changes.
seq_hash = cl.movesequence;
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
for (seat = 0; seat < cl.splitclients; seat++)
{
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
// send this and the previous cmds in the message, so
// if the last packet was dropped, it can be recovered
i = cl.movesequence & UPDATE_MASK;
cmd = &cl.outframes[i].cmd[seat];
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
//q2admin is retarded and kicks you if you get a stall.
if (cmd->msec > 100)
cmd->msec = 100;
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
MSG_WriteByte (buf, clcq2_move);
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 (seat)
{
//multi-seat still has an extra clc_move per seat
//but no checksum (pointless when its opensource anyway)
//no sequence (only seat 0 reports that)
checksumIndex = -1;
}
else
{
// save the position for a checksum qbyte
if (cls.protocol_q2 == PROTOCOL_VERSION_R1Q2 || cls.protocol_q2 == PROTOCOL_VERSION_Q2PRO)
checksumIndex = -1;
else
{
checksumIndex = buf->cursize;
MSG_WriteByte (buf, 0);
}
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 (!cl.q2frame.valid || cl_nodelta.ival || (cls.demorecording && !cls.demohadkeyframe))
MSG_WriteLong (buf, -1); // no compression
else
MSG_WriteLong (buf, cl.q2frame.serverframe);
}
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
lightlev = R_LightPoint(cl.playerview[seat].simorg);
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
// msecs = msecs - (double)msecstouse;
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
i = cls.netchan.outgoing_sequence & UPDATE_MASK;
cmd = &cl.outframes[i].cmd[seat];
*cmd = cl_pendingcmd[seat];
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
cmd->lightlevel = (lightlev>255)?255:lightlev;
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
cl.outframes[i].senttime = realtime;
cl.outframes[i].latency = -1;
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 (cmd->buttons)
cmd->buttons |= 128; //fixme: this isn't really what's meant by the anykey.
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
// calculate a checksum over the move commands
dontdrop |= CL_WriteDeltas(seat, buf);
if (checksumIndex >= 0)
{
buf->data[checksumIndex] = Q2COM_BlockSequenceCRCByte(
buf->data + checksumIndex + 1, buf->cursize - checksumIndex - 1,
seq_hash);
}
added qccgui icon (courtesy of shpuld) isolated transfers a little. added preliminary support for r1q2 and q2pro protocols (no zlib). fixed some missing q2 hud configstrings. fixed models attached to particles not appearing the first time around. fixed halos appearing on {foo fullbright textures. fix particle crash bug from missing particlecubes. implement r_converteffectinfo (instead of r_importeffectinfo with r_exportalleffects) for convenience. also now more complete and more accurate. loadfont no longer auto-allocates slot 0. fix issues with r_dynamic -1 don't restart audio on vid_reload (only reload it). this fixes audio issues with capturedemo with gamedir changes. fix possible crash from loading sounds during an audio reload/restart. now listens on both ports 27500 and 26000 when running quake, by default. sv_port or -port args will override. work around surfedge corruption in some instance of the slide4 map that dimman found. attempt to nudge players to travel at at least 200qu when travelling vertically through portals. this should help alieviate gravity-induced stuttering issues. fix nested function types used in conjunction with op_state. now assumes static within the parent. optimise array indexes slightly. fix issue with ptr[float].foo fix some qcc bugs to do with implicit type conversions fix a portal / angle protocol extension issue, so legacy clients can use portals, they just can't see the other side (nor predict them). fix q2 victory.pcx issue at the end of the game. use abort/sigabort instead of sigsegv on linux sys_errors. this should help get people to report stuff better. reformat the nq server advertising to be more helpful. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4996 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-12-28 17:41:39 +00:00
}
CL_ClearPendingCommands();
added qccgui icon (courtesy of shpuld) isolated transfers a little. added preliminary support for r1q2 and q2pro protocols (no zlib). fixed some missing q2 hud configstrings. fixed models attached to particles not appearing the first time around. fixed halos appearing on {foo fullbright textures. fix particle crash bug from missing particlecubes. implement r_converteffectinfo (instead of r_importeffectinfo with r_exportalleffects) for convenience. also now more complete and more accurate. loadfont no longer auto-allocates slot 0. fix issues with r_dynamic -1 don't restart audio on vid_reload (only reload it). this fixes audio issues with capturedemo with gamedir changes. fix possible crash from loading sounds during an audio reload/restart. now listens on both ports 27500 and 26000 when running quake, by default. sv_port or -port args will override. work around surfedge corruption in some instance of the slide4 map that dimman found. attempt to nudge players to travel at at least 200qu when travelling vertically through portals. this should help alieviate gravity-induced stuttering issues. fix nested function types used in conjunction with op_state. now assumes static within the parent. optimise array indexes slightly. fix issue with ptr[float].foo fix some qcc bugs to do with implicit type conversions fix a portal / angle protocol extension issue, so legacy clients can use portals, they just can't see the other side (nor predict them). fix q2 victory.pcx issue at the end of the game. use abort/sigabort instead of sigsegv on linux sys_errors. this should help get people to report stuff better. reformat the nq server advertising to be more helpful. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4996 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-12-28 17:41:39 +00:00
if (cl.sendprespawn || !cls.protocol_q2)
buf->cursize = 0; //tastyspleen.net is alergic.
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
else
CL_UpdateSeats();
return dontdrop;
}
#endif
qboolean CLQW_SendCmd (sizebuf_t *buf, qboolean actuallysend)
{
int seq_hash;
qboolean dontdrop = false;
usercmd_t *cmd;
int checksumIndex, firstsize, plnum;
int clientcount, lost;
int curframe;
int st = buf->cursize;
int chatstate;
cl.movesequence = cls.netchan.outgoing_sequence; //make sure its correct even over map changes.
curframe = cl.movesequence & UPDATE_MASK;
seq_hash = cl.movesequence;
cl.outframes[curframe].server_message_num = cl.validsequence;
cl.outframes[curframe].cmd_sequence = cl.movesequence;
cl.outframes[curframe].senttime = realtime;
cl.outframes[curframe].latency = -1;
// send this and the previous cmds in the message, so
// if the last packet was dropped, it can be recovered
clientcount = cl.splitclients;
if (!clientcount)
clientcount = 1;
chatstate = 0;
if (cl_sendchatstate.ival)
{
if (Key_Dest_Has(kdm_message|kdm_console|kdm_cwindows))
chatstate |= 1; //chatting
else if (Key_Dest_Has(~(kdm_game|kdm_centerprint)))
chatstate |= 2; //afk. ezquake sends chatting, but neither are really appropriate.
if (!vid.activeapp || vid.isminimized)
chatstate |= 2; //afk.
//FIXME: flag as afk if no new inputs for a while.
}
for (plnum = 0; plnum<clientcount; plnum++)
{
if (cl.playerview[plnum].chatstate != chatstate)
{
if (chatstate)
CL_SetInfo(plnum, "chat", va("%i", chatstate));
else
CL_SetInfo(plnum, "chat", "");
cl.playerview[plnum].chatstate = chatstate;
}
cmd = &cl.outframes[curframe].cmd[plnum];
*cmd = cl_pendingcmd[plnum];
cmd->lightlevel = 0;
#ifdef CSQC_DAT
if (!runningindepphys)
CSQC_Input_Frame(plnum, cmd);
#endif
}
CL_ClearPendingCommands();
cmd = &cl.outframes[curframe].cmd[0];
if (cmd->cursor_screen[0] || cmd->cursor_screen[1] || cmd->cursor_entitynumber ||
cmd->cursor_start[0] || cmd->cursor_start[1] || cmd->cursor_start[2] ||
cmd->cursor_impact[0] || cmd->cursor_impact[1] || cmd->cursor_impact[2])
{
fix colormod added frag message filter, and dedicated frag tracker. added 'windowed consoles' for social-type stuff without depending upon csqc mods for it. added in_deviceids command which allows listing/renumbering device ids. slider widgets now support inverted ranges, so gamma selection isn't so weird. fix top/bottom colour selection bug. software banding feature is now part of the 'software' preset (now that it supports mipmaps). support for loading .maps, and editing their brushes etc (with appropriate qc mod). 'map mymap.map' to use. expect problems with missing wads and replacement textures overriding them and messing up texture scales. snd_inactive is now default. fix threading issue with wavs, no more error from 0-sample-but-otherwise-valid wavs. added -makeinstaller option to embed a manifest inside the exe (and icon). the resulting program will insist on installing the game if its run from outside a valid basedir. framegroup support for q1mdl. textures are now loaded on multiple worker threads, for reduced load times. moo har har. netgraph shows packet+byte rates too. added r_lightstylescale, pretty similar to contrast, but doesn't impose any framerate cost, but may have overbrighting issues. r_softwarebanding now works on q2bsp too. fixed crepuscular lights. gzip transfer encoding is performed while downloading, instead of inducing stalls. FINALLY fix ezquake download compat issue (dimman found the issue). git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4851 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-04-15 00:12:17 +01:00
MSG_WriteByte (buf, clcfte_prydoncursor);
MSG_WriteShort(buf, cmd->cursor_screen[0] * 32767.0f);
MSG_WriteShort(buf, cmd->cursor_screen[1] * 32767.0f);
MSG_WriteFloat(buf, cmd->cursor_start[0]);
MSG_WriteFloat(buf, cmd->cursor_start[1]);
MSG_WriteFloat(buf, cmd->cursor_start[2]);
MSG_WriteFloat(buf, cmd->cursor_impact[0]);
MSG_WriteFloat(buf, cmd->cursor_impact[1]);
MSG_WriteFloat(buf, cmd->cursor_impact[2]);
MSG_WriteEntity(buf, cmd->cursor_entitynumber);
}
MSG_WriteByte (buf, clc_move);
// save the position for a checksum qbyte
checksumIndex = buf->cursize;
MSG_WriteByte (buf, 0);
// write our lossage percentage
rewrote ban code, merging bans+nonbans+cuffs+mute+cripple+deaf+lagged+vip. added timeouts. new penalties have no dedicated command. use the addip command for it. maplist command now generates links. implemented skin objects for q3. added a csqc builtin for it. also supports compositing skins. playing demos inside zips/pk3s/paks should now work. bumped default rate cvar. added cl_transfer to attempt to connect to a new server without disconnecting first. rewrote fog command. alpha and mindist arguments are now supported. fog change also happens over a short time period. added new args to the showpic console command. can now create clickable items for touchscreen/absmouse users. fixed menus to properly support right-aligned text. this finally fixes variable-width fonts. rewrote console tab completion suggestions display. now clickable links. strings obtained from qc are now marked as const. this has required quite a few added consts all over the place. probably crappy attempt at adding joypad support to the sdl port. no idea if it works. changed key bind event code. buttons now track which event they should trigger when released, instead of being the same one the whole time. this allows +forward etc clickable buttons on screen. Also simplified modifier keys - they no longer trigger random events when pressing the modifier key itself. Right modifiers can now be bound separately from left modifiers. Right will use left's binding if not otherwise bound. Bind assumes left if there's no prefix. multiplayer->setup->network menu no longer crashes. added rgb colours to the translation view (but not to the colour-changing keys). added modelviewer command to view models. added menu_mods menu to switch mods in a more friendly way. will be shown by default if multiple manifests exist in the binarydir. clamped classic tracer density. scrag particles no longer look quite so buggy. added ifdefs to facilitate a potential winrt port. the engine should now have no extra dependencies, but still needs system code+audio drivers to be written. if it can't set a renderer, it'll now try to use *every* renderer until it finds one that works. added experimental mapcluster server mode (that console command). New maps will be started up as required. rewrote skeletal blending code a bit. added cylinder geomtypes. fix cfg_save writing to the wrong path bug. VFS_CLOSE now returns a boolean. false means there was some sort of fatal error (either crc when reading was bad, or the write got corrupted or something). Typically ignorable, depends how robust you want to be. win32 tls code now supports running as a server. added connect tls://address support, as well as equivalent sv_addport support. exposed basic model loading api to plugins. d3d11 backend now optionally supports tessellation hlsl. no suitable hlsl provided by default. !!tess to enable. attempted to add gamma ramp support for d3d11. added support for shader blobs to speed up load times. r_shaderblobs 1 to enable. almost vital for d3d11. added vid_srgb cvar. shadowless lights are no longer disabled if shadows are not supported. attempt to add support for touchscreens in win7/8. Wrote gimmicky lua support, using lua instead of ssqc. define VM_LUA to enable. updated saved game code. can again load saved games from vanilla-like engines. changed scale clamping. 0.0001 should no longer appear as 1. changed default mintic from 0.03 to 0.013 to match vanilla qw. I don't know why it was at 0.03. probably a typo. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4623 fc73d0e0-1445-4013-8a0c-d673dee63da5
2014-03-30 09:55:06 +01:00
lost = CL_CalcNet(r_netgraph.value);
MSG_WriteByte (buf, (qbyte)lost);
firstsize=0;
for (plnum = 0; plnum<clientcount; plnum++)
{
cmd = &cl.outframes[curframe].cmd[plnum];
if (plnum)
MSG_WriteByte (buf, clc_move);
dontdrop = CL_WriteDeltas(plnum, buf) || dontdrop;
if (!firstsize)
firstsize = buf->cursize;
}
// calculate a checksum over the move commands
buf->data[checksumIndex] = COM_BlockSequenceCRCByte(
buf->data + checksumIndex + 1, firstsize - checksumIndex - 1,
seq_hash);
// request delta compression of entities
if (cls.netchan.outgoing_sequence - cl.validsequence >= UPDATE_BACKUP-1)
cl.validsequence = 0;
//delta_sequence is the _expected_ previous sequences, so is set before it arrives.
if (cl.validsequence && !cl_nodelta.ival && cls.state == ca_active && !cls.demorecording)
{
cl.inframes[cls.netchan.outgoing_sequence&UPDATE_MASK].delta_sequence = cl.validsequence;
MSG_WriteByte (buf, clc_delta);
// Con_Printf("%i\n", cl.validsequence);
MSG_WriteByte (buf, cl.validsequence&255);
}
else
cl.inframes[cls.netchan.outgoing_sequence&UPDATE_MASK].delta_sequence = -1;
if (cl.sendprespawn || !actuallysend)
buf->cursize = st; //don't send movement commands while we're still supposedly downloading. mvdsv does not like that.
else
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
CL_UpdateSeats();
return dontdrop;
}
static void CL_SendUserinfoUpdate(void)
{
const char *key = cls.userinfosync.keys[0].name;
infobuf_t *info = cls.userinfosync.keys[0].context;
size_t bloboffset = cls.userinfosync.keys[0].syncpos;
unsigned int seat = info - cls.userinfo;
size_t blobsize;
const char *blobdata = InfoBuf_BlobForKey(info, key, &blobsize, NULL);
size_t sendsize = blobsize - bloboffset;
const char *s;
qboolean final = true;
char enckey[2048];
char encval[2048];
//handle splitscreen
char pl[64];
if (seat)
Q_snprintfz(pl, sizeof(pl), "%i ", seat);
else
*pl = 0;
#ifdef Q3CLIENT
if (cls.protocol == CP_QUAKE3)
{ //q3 sends it all in one go
char userinfo[2048];
InfoSync_Strip(&cls.userinfosync, info); //can't track this stuff. all or nothing.
if (info == &cls.userinfo[0])
{
InfoBuf_ToString(info, userinfo, sizeof(userinfo), NULL, NULL, NULL, NULL, NULL);
CLQ3_SendClientCommand("userinfo \"%s\"", userinfo);
}
return;
}
#endif
#ifdef Q2CLIENT
if (cls.protocol == CP_QUAKE2 && !cls.fteprotocolextensions)
{
char userinfo[2048];
InfoSync_Strip(&cls.userinfosync, info); //can't track this stuff. all or nothing.
if (info == &cls.userinfo[0])
{
InfoBuf_ToString(info, userinfo, sizeof(userinfo), NULL, NULL, NULL, NULL, NULL);
MSG_WriteByte (&cls.netchan.message, clcq2_userinfo);
SZ_Write(&cls.netchan.message, pl, strlen(pl));
MSG_WriteString (&cls.netchan.message, userinfo);
}
return;
}
#endif
if (seat < max(1,cl.splitclients))
{
if (sendsize > 1023)
{
final = false;
sendsize = 1023; //should be a multiple of 3
}
if (!InfoBuf_EncodeString(key, strlen(key), enckey, sizeof(enckey)) ||
!InfoBuf_EncodeString(blobdata+bloboffset, sendsize, encval, sizeof(encval)))
{ //some buffer wasn't big enough... shouldn't happen.
InfoSync_Remove(&cls.userinfosync, 0);
return;
}
if (final && !bloboffset && *encval != '\xff' && *encval != '\xff')
{ //vanilla-compatible info.
s = va("%ssetinfo \"%s\" \"%s\"", pl, enckey, encval);
}
else if (cls.fteprotocolextensions2 & PEXT2_INFOBLOBS)
{ //only flood servers that actually support it.
if (final)
s = va("%ssetinfo \"%s\" \"%s\" %u", pl, enckey, encval, (unsigned int)bloboffset);
else
s = va("%ssetinfo \"%s\" \"%s\" %u+", pl, enckey, encval, (unsigned int)bloboffset);
}
else
{ //server doesn't support it, just ignore the key
InfoSync_Remove(&cls.userinfosync, 0);
return;
}
if (cls.protocol == CP_QUAKE2)
MSG_WriteByte (&cls.netchan.message, clcq2_stringcmd);
else
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
MSG_WriteString (&cls.netchan.message, s);
}
if (bloboffset+sendsize == blobsize)
InfoSync_Remove(&cls.userinfosync, 0);
else
cls.userinfosync.keys[0].syncpos += sendsize;
}
void CL_SendCmd (double frametime, qboolean mainloop)
{
sizebuf_t buf;
qbyte data[MAX_DATAGRAM];
int i, plnum;
usercmd_t *cmd;
float wantfps;
int fullsend; //-1: send for sequence, with no usercmd. 0: update input frame, but don't send anything. 1: time for a new usercmd
static float pps_balance = 0;
static int dropcount = 0;
static double msecs;
static double msecsround;
qboolean dontdrop=false;
float usetime; //how many msecs we can use for the new frame
int msecstouse; //usetime truncated to network precision (how much we'll actually eat)
float framemsecs; //how long we're saying the input frame should be (differs from realtime with nq as we want to send frames reguarly, but note this might end up with funny-duration frames).
qboolean xonoticworkaround;
clcmdbuf_t *next;
if (runningindepphys)
{
double curtime;
static double lasttime;
curtime = Sys_DoubleTime();
frametime = curtime - lasttime;
lasttime = curtime;
}
CL_ProxyMenuHooks();
if (cls.demoplayback != DPB_NONE || cls.state <= ca_demostart)
{
cursor_active = false;
if (!cls.state || cls.demoplayback == DPB_MVD || cls.demoplayback == DPB_EZTV)
{
extern cvar_t cl_splitscreen;
cl.ackedmovesequence = cl.movesequence;
i = cl.movesequence & UPDATE_MASK;
cl.movesequence++;
cl.outframes[i].server_message_num = cl.validsequence;
cl.outframes[i].cmd_sequence = cl.movesequence;
cl.outframes[i].senttime = realtime; // we haven't gotten a reply yet
// cl.outframes[i].receivedtime = -1; // we haven't gotten a reply yet
if (cl.splitclients > cl_splitscreen.ival+1)
{
cl.splitclients = cl_splitscreen.ival+1;
if (cl.splitclients < 1)
cl.splitclients = 1;
}
for (plnum = 0; plnum < cl.splitclients; plnum++)
{
vec3_t mousemovements;
playerview_t *pv = &cl.playerview[plnum];
cmd = &cl.outframes[i].cmd[plnum];
memset(cmd, 0, sizeof(*cmd));
msecs += frametime*1000;
if (msecs > 50)
msecs = 50;
cmd->msec = msecs;
msecs -= cmd->msec;
cl_pendingcmd[plnum].msec = 0;
CL_AdjustAngles (plnum, frametime);
// get basic movement from keyboard
CL_BaseMove (cmd, plnum, 0, 1);
// allow mice or other external controllers to add to the move
VectorClear(mousemovements);
IN_Move (mousemovements, plnum, frametime);
cl_pendingcmd[plnum].forwardmove += mousemovements[0];
cl_pendingcmd[plnum].sidemove += mousemovements[1];
cl_pendingcmd[plnum].upmove += mousemovements[2];
CL_ClampPitch(plnum, frametime);
// if we are spectator, try autocam
if (pv->spectator)
Cam_Track(pv, cmd);
CL_FinishMove(cmd, plnum);
Cam_FinishMove(pv, cmd);
#ifdef CSQC_DAT
CSQC_Input_Frame(plnum, cmd);
#endif
if (cls.state == ca_active)
{
player_state_t *from, *to;
from = &cl.inframes[cl.ackedmovesequence & UPDATE_MASK].playerstate[pv->playernum];
to = &cl.inframes[cl.movesequence & UPDATE_MASK].playerstate[pv->playernum];
CL_PredictUsercmd(pv->playernum, pv->viewentity, from, to, &cl.outframes[cl.ackedmovesequence & UPDATE_MASK].cmd[plnum]);
}
}
while (clientcmdlist)
{
next = clientcmdlist->next;
CL_Demo_ClientCommand(clientcmdlist->command);
Con_DLPrintf(2, "Sending stringcmd %s\n", clientcmdlist->command);
Z_Free(clientcmdlist);
clientcmdlist = next;
}
cls.netchan.outgoing_sequence = cl.movesequence;
}
rewrote ban code, merging bans+nonbans+cuffs+mute+cripple+deaf+lagged+vip. added timeouts. new penalties have no dedicated command. use the addip command for it. maplist command now generates links. implemented skin objects for q3. added a csqc builtin for it. also supports compositing skins. playing demos inside zips/pk3s/paks should now work. bumped default rate cvar. added cl_transfer to attempt to connect to a new server without disconnecting first. rewrote fog command. alpha and mindist arguments are now supported. fog change also happens over a short time period. added new args to the showpic console command. can now create clickable items for touchscreen/absmouse users. fixed menus to properly support right-aligned text. this finally fixes variable-width fonts. rewrote console tab completion suggestions display. now clickable links. strings obtained from qc are now marked as const. this has required quite a few added consts all over the place. probably crappy attempt at adding joypad support to the sdl port. no idea if it works. changed key bind event code. buttons now track which event they should trigger when released, instead of being the same one the whole time. this allows +forward etc clickable buttons on screen. Also simplified modifier keys - they no longer trigger random events when pressing the modifier key itself. Right modifiers can now be bound separately from left modifiers. Right will use left's binding if not otherwise bound. Bind assumes left if there's no prefix. multiplayer->setup->network menu no longer crashes. added rgb colours to the translation view (but not to the colour-changing keys). added modelviewer command to view models. added menu_mods menu to switch mods in a more friendly way. will be shown by default if multiple manifests exist in the binarydir. clamped classic tracer density. scrag particles no longer look quite so buggy. added ifdefs to facilitate a potential winrt port. the engine should now have no extra dependencies, but still needs system code+audio drivers to be written. if it can't set a renderer, it'll now try to use *every* renderer until it finds one that works. added experimental mapcluster server mode (that console command). New maps will be started up as required. rewrote skeletal blending code a bit. added cylinder geomtypes. fix cfg_save writing to the wrong path bug. VFS_CLOSE now returns a boolean. false means there was some sort of fatal error (either crc when reading was bad, or the write got corrupted or something). Typically ignorable, depends how robust you want to be. win32 tls code now supports running as a server. added connect tls://address support, as well as equivalent sv_addport support. exposed basic model loading api to plugins. d3d11 backend now optionally supports tessellation hlsl. no suitable hlsl provided by default. !!tess to enable. attempted to add gamma ramp support for d3d11. added support for shader blobs to speed up load times. r_shaderblobs 1 to enable. almost vital for d3d11. added vid_srgb cvar. shadowless lights are no longer disabled if shadows are not supported. attempt to add support for touchscreens in win7/8. Wrote gimmicky lua support, using lua instead of ssqc. define VM_LUA to enable. updated saved game code. can again load saved games from vanilla-like engines. changed scale clamping. 0.0001 should no longer appear as 1. changed default mintic from 0.03 to 0.013 to match vanilla qw. I don't know why it was at 0.03. probably a typo. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4623 fc73d0e0-1445-4013-8a0c-d673dee63da5
2014-03-30 09:55:06 +01:00
IN_Move (NULL, 0, frametime);
Cbuf_Waited(); //its okay to stop waiting now
return; // sendcmds come from the demo
}
memset(&buf, 0, sizeof(buf));
buf.maxsize = sizeof(data);
buf.cursize = 0;
buf.data = data;
buf.prim = cls.netchan.message.prim;
xonoticworkaround = cls.protocol == CP_NETQUAKE && CPNQ_IS_DP && cl.time && !cl.paused;
if (xonoticworkaround)
{
if (cl.movesequence_time > cl.time + 0.5)
cl.movesequence_time = cl.time + 0.5; //shouldn't really happen
if (cl.movesequence_time < cl.time - 0.5)
cl.movesequence_time = cl.time - 0.5; //shouldn't really happen
framemsecs = (cl.time - cl.movesequence_time)*1000;
wantfps = cl_netfps.value;
usetime = CL_FilterTime(framemsecs, wantfps, 5, false);
if (usetime > 0)
{
usetime = framemsecs - usetime;
fullsend = true;
}
else
{
usetime = framemsecs - usetime;
fullsend = false;
}
msecstouse = usetime;
framemsecs = msecstouse;
msecs = 0;
}
else
{
msecs += frametime*1000;
// Con_Printf("%f\n", msecs);
wantfps = cl_netfps.value;
fullsend = true;
msecstouse = 0;
#ifndef CLIENTONLY
if (sv.state && cls.state != ca_active)
{ //HACK: if we're also the server, spam like a crazy person until we're on the server, for faster apparent load times.
fullsend = -1; //send no movement command.
msecstouse = usetime = msecs;
}
else
#endif
{
// while we're not playing send a slow keepalive fullsend to stop mvdsv from screwing up
if (cls.state < ca_active && !cls.download)
{
#ifdef IRCCONNECT //don't spam irc.
if (cls.netchan.remote_address.type == NA_IRC)
wantfps = 0.5;
else
#endif
wantfps = 12.5;
}
if (!runningindepphys && (cl_netfps.value > 0 || !fullsend))
{
float spare;
spare = CL_FilterTime(msecs, wantfps, (/*cls.protocol == CP_NETQUAKE*/0?0:1.5), false);
usetime = msecsround + (msecs - spare);
msecstouse = (int)usetime;
if (!spare)
fullsend = false;
else
{
msecsround = usetime - msecstouse;
msecs = spare + msecstouse;
}
}
else
{
usetime = msecsround + msecs;
msecstouse = (int)usetime;
msecsround = usetime - msecstouse;
}
}
if (msecstouse > 200) // cap at 200 to avoid servers splitting movement more than four times
msecstouse = 200;
// align msecstouse to avoid servers wasting our msecs
if (msecstouse > 100)
msecstouse &= ~3; // align to 4
else if (msecstouse > 50)
msecstouse &= ~1; // align to 2
if (msecstouse <= 0) //FIXME
fullsend = false;
if (usetime <= 0)
return; //infinite frame times = weirdness.
framemsecs = msecstouse;
if (cls.protocol == CP_NETQUAKE)
framemsecs = 1000*(cl.time - cl.movesequence_time);
}
#ifdef HLCLIENT
if (!CLHL_BuildUserInput(msecstouse, &cl_pendingcmd[0]))
#endif
for (plnum = 0; plnum < (cl.splitclients?cl.splitclients:1); plnum++)
{
vec3_t mousemovements;
CL_AdjustAngles (plnum, frametime);
VectorClear(mousemovements);
IN_Move (mousemovements, plnum, frametime);
CL_ClampPitch(plnum, frametime);
cl_pendingcmd[plnum].forwardmove += mousemovements[0]; //FIXME: this will get nuked by CL_BaseMove.
cl_pendingcmd[plnum].sidemove += mousemovements[1];
cl_pendingcmd[plnum].upmove += mousemovements[2];
for (i=0 ; i<3 ; i++)
cl_pendingcmd[plnum].angles[i] = ((int)(cl.playerview[plnum].viewangles[i]*65536.0/360)&65535);
CL_BaseMove (&cl_pendingcmd[plnum], plnum, cl_pendingcmd[plnum].msec, framemsecs);
if (!cl_pendingcmd[plnum].msec && framemsecs)
{
CL_FinishMove(&cl_pendingcmd[plnum], plnum);
Cbuf_Waited(); //its okay to stop waiting now
}
cl_pendingcmd[plnum].msec = framemsecs;
// if we are spectator, try autocam
// if (cl.spectator)
Cam_Track(&cl.playerview[plnum], &cl_pendingcmd[plnum]);
Cam_FinishMove(&cl.playerview[plnum], &cl_pendingcmd[plnum]);
}
//the main loop isn't allowed to send
if (runningindepphys && mainloop)
return;
// if (skipcmd)
// return;
if (!fullsend)
return; // when we're actually playing we try to match netfps exactly to avoid gameplay problems
// if (msecstouse > 127)
// Con_Printf("%i\n", msecstouse, msecs);
//HACK: 1000/77 = 12.98. nudge it just under so we never appear to be using 83fps at 77fps (which can trip cheat detection in mods that expect 72 fps when many servers are configured for 77)
//so lets just never use 12.
if (fullsend && cls.maxfps == 77)
for (plnum = 0; plnum < (cl.splitclients?cl.splitclients:1); plnum++)
if (cl_pendingcmd[plnum].msec > 12.9 && cl_pendingcmd[plnum].msec < 13)
cl_pendingcmd[plnum].msec = 13;
#ifdef NQPROT
if (cls.protocol != CP_NETQUAKE || cls.netchan.nqreliable_allowed)
#endif
{
CL_SendDownloadReq(&buf);
//only start spamming userinfo blobs once we receive the initial serverinfo.
while (cls.userinfosync.numkeys && cls.netchan.message.cursize < 512 && (cl.haveserverinfo || cls.protocol == CP_QUAKE2 || cls.protocol == CP_QUAKE3))
CL_SendUserinfoUpdate();
while (clientcmdlist)
{
next = clientcmdlist->next;
if (clientcmdlist->reliable)
{
if (cls.netchan.message.cursize + 2+strlen(clientcmdlist->command)+100 > cls.netchan.message.maxsize)
break;
if (!strncmp(clientcmdlist->command, "spawn", 5) && cls.userinfosync.numkeys && cl.haveserverinfo)
break; //HACK: don't send the spawn until all pending userinfos have been flushed.
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
MSG_WriteString (&cls.netchan.message, clientcmdlist->command);
}
else
{
if (buf.cursize + 2+strlen(clientcmdlist->command)+100 <= buf.maxsize)
{
MSG_WriteByte (&buf, clc_stringcmd);
MSG_WriteString (&buf, clientcmdlist->command);
}
}
Con_DLPrintf(2, "Sending stringcmd %s\n", clientcmdlist->command);
Z_Free(clientcmdlist);
clientcmdlist = next;
}
}
// if we're not doing clc_moves and etc, don't continue unless we wrote something previous
// or we have something on the reliable buffer (or we're loopback and don't care about flooding)
if (!fullsend && cls.netchan.remote_address.type != NA_LOOPBACK && buf.cursize < 1 && cls.netchan.message.cursize < 1)
return;
if (fullsend)
{
if (!cls.state)
{
msecs -= (double)msecstouse;
return;
}
cursor_active = false;
for (plnum = 0; plnum < cl.splitclients; plnum++)
{
cmd = &cl_pendingcmd[plnum];
if (((cls.fteprotocolextensions2 & PEXT2_PRYDONCURSOR)||(cls.protocol == CP_NETQUAKE && cls.protocol_nq >= CPNQ_DP6)) &&
(*cl_prydoncursor.string && cl_prydoncursor.ival >= 0) && cls.state == ca_active)
CL_UpdatePrydonCursor(cmd, plnum);
else
{
Vector2Clear(cmd->cursor_screen);
VectorClear(cmd->cursor_start);
VectorClear(cmd->cursor_impact);
cmd->cursor_entitynumber = 0;
}
}
if (xonoticworkaround)
cl.movesequence_time += msecstouse/1000.0;
else
cl.movesequence_time = cl.time;
switch (cls.protocol)
{
#ifdef NQPROT
case CP_NETQUAKE:
msecs -= (double)msecstouse;
CLNQ_SendCmd (&buf);
dontdrop = true;
break;
#endif
case CP_QUAKEWORLD:
msecs -= (double)msecstouse;
dontdrop = CLQW_SendCmd (&buf, fullsend == true);
break;
#ifdef Q2CLIENT
case CP_QUAKE2:
msecs -= (double)msecstouse;
dontdrop = CLQ2_SendCmd (&buf);
break;
#endif
#ifdef Q3CLIENT
case CP_QUAKE3:
msecs -= (double)msecstouse;
CLQ3_SendCmd(&cl_pendingcmd[0]);
CL_ClearPendingCommands();
//don't bank too much, because that results in banking speedcheats
if (msecs > 200)
msecs = 200;
return; // Q3 does it's own thing
#endif
default:
Host_EndGame("Invalid protocol in CL_SendCmd: %i", cls.protocol);
return;
}
if (cls.demorecording)
CL_WriteDemoCmd(&cl.outframes[cl.movesequence & UPDATE_MASK].cmd[0]);
// Con_DPrintf("generated sequence %i\n", cl.movesequence);
cl.movesequence++;
//clear enough of the pending command for the next frame.
for (plnum = 0; plnum < cl.splitclients; plnum++)
{
cl_pendingcmd[plnum].msec = 0;
cl_pendingcmd[plnum].impulse = 0;
// cl_pendingcmd[plnum].buttons = 0;
}
}
#ifdef IRCCONNECT
if (cls.netchan.remote_address.type == NA_IRC)
{
if (dropcount >= 2)
{
dropcount = 0;
}
else
{
// don't count this message when calculating PL
cl.outframes[cls.netchan.outgoing_sequence&UPDATE_MASK].latency = -3;
// drop this message
cls.netchan.outgoing_sequence++;
dropcount++;
return;
}
}
else
#endif
//shamelessly stolen from fuhquake
if (cl_c2spps.ival>0)
{
pps_balance += frametime;
// never drop more than 2 messages in a row -- that'll cause PL
// and don't drop if one of the last two movemessages have an impulse
if (pps_balance > 0 || dropcount >= 2 || dontdrop)
{
float pps;
pps = cl_c2spps.ival;
if (pps < 10) pps = 10;
if (pps > 72) pps = 72;
pps_balance -= 1 / pps;
// bound pps_balance. FIXME: is there a better way?
if (pps_balance > 0.1) pps_balance = 0.1;
if (pps_balance < -0.1) pps_balance = -0.1;
dropcount = 0;
}
else
{
// don't count this message when calculating PL
cl.outframes[(cl.movesequence-1) & UPDATE_MASK].latency = -3;
// drop this message
cls.netchan.outgoing_sequence++;
dropcount++;
return;
}
}
else
{
pps_balance = 0;
dropcount = 0;
}
#ifdef VOICECHAT
if (cls.protocol == CP_QUAKE2)
S_Voip_Transmit(clcq2_voicechat, &buf);
else
fix colormod added frag message filter, and dedicated frag tracker. added 'windowed consoles' for social-type stuff without depending upon csqc mods for it. added in_deviceids command which allows listing/renumbering device ids. slider widgets now support inverted ranges, so gamma selection isn't so weird. fix top/bottom colour selection bug. software banding feature is now part of the 'software' preset (now that it supports mipmaps). support for loading .maps, and editing their brushes etc (with appropriate qc mod). 'map mymap.map' to use. expect problems with missing wads and replacement textures overriding them and messing up texture scales. snd_inactive is now default. fix threading issue with wavs, no more error from 0-sample-but-otherwise-valid wavs. added -makeinstaller option to embed a manifest inside the exe (and icon). the resulting program will insist on installing the game if its run from outside a valid basedir. framegroup support for q1mdl. textures are now loaded on multiple worker threads, for reduced load times. moo har har. netgraph shows packet+byte rates too. added r_lightstylescale, pretty similar to contrast, but doesn't impose any framerate cost, but may have overbrighting issues. r_softwarebanding now works on q2bsp too. fixed crepuscular lights. gzip transfer encoding is performed while downloading, instead of inducing stalls. FINALLY fix ezquake download compat issue (dimman found the issue). git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4851 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-04-15 00:12:17 +01:00
S_Voip_Transmit(clcfte_voicechat, &buf);
#endif
//
// deliver the message
//
cls.netchan.dupe = cl_c2sdupe.ival;
Netchan_Transmit (&cls.netchan, buf.cursize, buf.data, 2500);
//don't bank too much, because that results in banking speedcheats
if (msecs > 200)
msecs = 200;
if (cls.netchan.fatal_error)
{
cls.netchan.fatal_error = false;
cls.netchan.message.overflowed = false;
cls.netchan.message.cursize = 0;
}
}
void CL_SendCvar_f (void)
{
cvar_t *var;
char *val;
char *name = Cmd_Argv(1);
var = Cvar_FindVar(name);
if (!var)
val = "";
else if (var->flags & CVAR_NOUNSAFEEXPAND)
val = "";
else
val = var->string;
CL_SendClientCommand(true, "sentcvar %s \"%s\"", name, val);
}
/*
============
CL_InitInput
============
*/
void CL_InitInput (void)
{
static char pcmd[MAX_SPLITS][3][5];
unsigned int sp, i;
#define inputnetworkcvargroup "client networking options"
cl.splitclients = 1;
Cmd_AddCommand("rotate", IN_Rotate_f);
Cmd_AddCommand("in_restart", IN_Restart);
Cmd_AddCommand("sendcvar", CL_SendCvar_f);
Cvar_Register (&cl_fastaccel, inputnetworkcvargroup);
Cvar_Register (&in_xflip, inputnetworkcvargroup);
Cvar_Register (&cl_nodelta, inputnetworkcvargroup);
Cvar_Register (&prox_inmenu, inputnetworkcvargroup);
Cvar_Register (&cl_c2sdupe, inputnetworkcvargroup);
Cvar_Register (&cl_c2sImpulseBackup, inputnetworkcvargroup);
Cvar_Register (&cl_c2spps, inputnetworkcvargroup);
Cvar_Register (&cl_queueimpulses, inputnetworkcvargroup);
Cvar_Register (&cl_netfps, inputnetworkcvargroup);
Cvar_Register (&cl_sparemsec, inputnetworkcvargroup);
Cvar_Register (&cl_run, inputnetworkcvargroup);
Cvar_Register (&cl_iDrive, inputnetworkcvargroup);
#ifdef NQPROT
Cvar_Register (&cl_movement, inputnetworkcvargroup);
#endif
Cvar_Register (&cl_sendchatstate, inputnetworkcvargroup);
Cvar_Register (&cl_smartjump, inputnetworkcvargroup);
Cvar_Register (&cl_prydoncursor, inputnetworkcvargroup);
Cvar_Register (&cl_instantrotate, inputnetworkcvargroup);
Cvar_Register (&cl_forceseat, inputnetworkcvargroup);
for (sp = 0; sp < MAX_SPLITS; sp++)
{
Q_snprintfz(pcmd[sp][0], sizeof(pcmd[sp][0]), "p%i", sp+1);
Q_snprintfz(pcmd[sp][1], sizeof(pcmd[sp][1]), "+p%i", sp+1);
Q_snprintfz(pcmd[sp][2], sizeof(pcmd[sp][2]), "-p%i", sp+1);
Cmd_AddCommand (pcmd[sp][0], CL_Split_f);
Cmd_AddCommand (pcmd[sp][1], CL_Split_f);
Cmd_AddCommand (pcmd[sp][2], CL_Split_f);
/*default mlook to pressed, (on android we split the two sides of the screen)*/
in_mlook.state[sp] = 1;
}
/*then alternative arged ones*/
Cmd_AddCommand ("p", CL_SplitA_f);
Cmd_AddCommand ("+p", CL_SplitA_f);
Cmd_AddCommand ("-p", CL_SplitA_f);
Cmd_AddCommand ("+moveup", IN_UpDown);
Cmd_AddCommand ("-moveup", IN_UpUp);
Cmd_AddCommand ("+movedown", IN_DownDown);
Cmd_AddCommand ("-movedown", IN_DownUp);
Cmd_AddCommand ("+left", IN_LeftDown);
Cmd_AddCommand ("-left", IN_LeftUp);
Cmd_AddCommand ("+right", IN_RightDown);
Cmd_AddCommand ("-right", IN_RightUp);
Cmd_AddCommand ("+forward", IN_ForwardDown);
Cmd_AddCommand ("-forward", IN_ForwardUp);
Cmd_AddCommand ("+back", IN_BackDown);
Cmd_AddCommand ("-back", IN_BackUp);
Cmd_AddCommand ("+lookup", IN_LookupDown);
Cmd_AddCommand ("-lookup", IN_LookupUp);
Cmd_AddCommand ("+lookdown", IN_LookdownDown);
Cmd_AddCommand ("-lookdown", IN_LookdownUp);
Cmd_AddCommand ("+strafe", IN_StrafeDown);
Cmd_AddCommand ("-strafe", IN_StrafeUp);
Cmd_AddCommand ("+moveleft", IN_MoveleftDown);
Cmd_AddCommand ("-moveleft", IN_MoveleftUp);
Cmd_AddCommand ("+moveright", IN_MoverightDown);
Cmd_AddCommand ("-moveright", IN_MoverightUp);
Cmd_AddCommand ("+rollleft", IN_RollLeftDown);
Cmd_AddCommand ("-rollleft", IN_RollLeftUp);
Cmd_AddCommand ("+rollright", IN_RollRightDown);
Cmd_AddCommand ("-rollright", IN_RollRightUp);
Cmd_AddCommand ("+speed", IN_SpeedDown);
Cmd_AddCommand ("-speed", IN_SpeedUp);
Cmd_AddCommand ("+attack", IN_AttackDown);
Cmd_AddCommand ("-attack", IN_AttackUp);
Cmd_AddCommand ("+use", IN_UseDown);
Cmd_AddCommand ("-use", IN_UseUp);
Cmd_AddCommand ("+jump", IN_JumpDown);
Cmd_AddCommand ("-jump", IN_JumpUp);
Cmd_AddCommandD("impulse", IN_Impulse, "Sends an impulse number to the server (read: weapon change).");
Cmd_AddCommand ("+klook", IN_KLookDown);
Cmd_AddCommand ("-klook", IN_KLookUp);
Cmd_AddCommand ("+mlook", IN_MLookDown);
Cmd_AddCommand ("-mlook", IN_MLookUp);
#ifdef QUAKESTATS
Cvar_Register (&cl_weaponhide, inputnetworkcvargroup);
Cvar_Register (&cl_weaponhide_preference, inputnetworkcvargroup);
Cvar_Register (&cl_weaponpreselect, inputnetworkcvargroup);
Cvar_Register (&cl_weaponforgetorder, inputnetworkcvargroup);
Cvar_Register (&r_viewpreselgun, inputnetworkcvargroup);
#endif
for (i = 0; i < countof(in_button); i++)
{
static char bcmd[countof(in_button)][2][10];
Q_snprintfz(bcmd[i][0], sizeof(bcmd[sp][0]), "+button%i", i);
Q_snprintfz(bcmd[i][1], sizeof(bcmd[sp][1]), "-button%i", i);
Cmd_AddCommandD(bcmd[i][0], IN_ButtonNDown, "This auxilliary command has mod-specific behaviour (often none).");
Cmd_AddCommand (bcmd[i][1], IN_ButtonNUp);
}
}