2012-10-14 09:00:49 +00:00
//Generic input code.
//mostly mouse support, but can also handle a few keyboard events.
2012-04-09 19:12:12 +00:00
2017-10-25 08:10:35 +00:00
//Issues:
//VirtualBox mouse integration is bugged. X11 code can handle tablets, but VirtualBox sends mouse clicks on the ps/2 device instead.
// you should be able to fix this with 'in_deviceids * 0 *', remapping both tablet+ps/2 to the same device id.
//Android touchscreen inputs suck. should have some onscreen buttons, but they're still a bit poo or something. blame mods for not using csqc to do things themselves.
2012-10-14 09:00:49 +00:00
# include "quakedef.h"
2012-04-09 19:12:12 +00:00
2017-09-20 11:27:13 +00:00
extern qboolean mouse_active ;
static cvar_t m_filter = CVARF ( " m_filter " , " 0 " , CVAR_ARCHIVE ) ;
2012-10-14 09:00:49 +00:00
static cvar_t m_forcewheel = CVARD ( " m_forcewheel " , " 1 " , " 0: ignore mousewheels in apis where it is abiguous. \n 1: Use mousewheel when it is treated as a third axis. Motion above a threshold is ignored, to avoid issues with an unknown threshold. \n 2: Like 1, but excess motion is retained. The threshold specifies exact z-axis distance per notice. " ) ;
2017-09-20 11:27:13 +00:00
static cvar_t m_forcewheel_threshold = CVARD ( " m_forcewheel_threshold " , " 32 " , " Mousewheel graduations smaller than this will not trigger mousewheel deltas. " ) ;
2018-06-06 09:09:14 +00:00
static cvar_t m_touchstrafe = CVARAFD ( " m_touchstrafe " , " 1 " , " m_strafeonright " , CVAR_ARCHIVE , " 0: entire screen changes angles only. \n 1: right hand side controls strafing. \n 2:left hand side strafes. " ) ;
2017-09-20 11:27:13 +00:00
static cvar_t m_fatpressthreshold = CVARFD ( " m_fatpressthreshold " , " 0.2 " , CVAR_ARCHIVE , " How fat your thumb has to be to register a fat press (touchscreens). " ) ;
static cvar_t m_touchmajoraxis = CVARFD ( " m_touchmajoraxis " , " 1 " , CVAR_ARCHIVE , " When using a touchscreen, use only the major axis for strafing. " ) ;
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 10:56:18 +00:00
static cvar_t m_slidethreshold = CVARFD ( " m_slidethreshold " , " 10 " , CVAR_ARCHIVE , " How far your finger needs to move to be considered a slide event (touchscreens). " ) ;
2015-11-18 07:37:39 +00:00
2016-02-10 23:23:43 +00:00
static cvar_t m_accel = CVARAFD ( " m_accel " , " 0 " , " cl_mouseAccel " , CVAR_ARCHIVE , " Values >0 will amplify mouse movement proportional to velocity. Small values have great effect. A lot of good Quake Live players use around the 0.1-0.2 mark, but this depends on your mouse CPI and polling rate. " ) ;
static cvar_t m_accel_style = CVARAD ( " m_accel_style " , " 1 " , " cl_mouseAccelStyle " , " 1 = Quake Live mouse acceleration, 0 = Old style accelertion. " ) ;
static cvar_t m_accel_power = CVARAD ( " m_accel_power " , " 2 " , " cl_mouseAccelPower " , " Used when m_accel_style is 1. \n Values 1 or below are dumb. 2 is linear and the default. 99% of accel users use this. Above 2 begins to amplify exponentially and you will get more acceleration at higher velocities. Great if you want low accel for slow movements, and high accel for fast movements. Good in combination with a sensitivity cap. " ) ;
static cvar_t m_accel_offset = CVARAD ( " m_accel_offset " , " 0 " , " cl_mouseAccelOffset " , " Used when m_accel_style is 1. \n Acceleration will not be active until the mouse movement exceeds this speed (counts per millisecond). Negative values are supported, which has the effect of causing higher rates of acceleration to happen at lower velocities. " ) ;
static cvar_t m_accel_senscap = CVARAD ( " m_accel_senscap " , " 0 " , " cl_mouseSensCap " , " Used when m_accel_style is 1. \n Sets an upper limit on the amplified mouse movement. Great for tuning acceleration around lower velocities while still remaining in control of fast motion such as flicking. " ) ;
2015-11-18 07:37:39 +00:00
void QDECL joyaxiscallback ( cvar_t * var , char * oldvalue )
{
int sign ;
char * end ;
strtol ( var - > string , & end , 0 ) ;
if ( ! * end ) //okay, its missing or an actual number.
return ;
end = var - > string ;
if ( * end = = ' - ' )
{
end + + ;
sign = - 1 ;
}
else if ( * end = = ' + ' )
{
end + + ;
sign = 1 ;
}
else
sign = 1 ;
if ( ! Q_strcasecmp ( end , " forward " ) | | ! Q_strcasecmp ( end , " moveforward " ) )
var - > ival = 1 * sign ;
else if ( ! Q_strcasecmp ( end , " back " ) | | ! Q_strcasecmp ( end , " moveback " ) )
var - > ival = 1 * sign * - 1 ;
2017-09-20 11:27:13 +00:00
else if ( ! Q_strcasecmp ( end , " lookup " ) | | ! Q_strcasecmp ( end , " pitchup " ) )
var - > ival = 2 * sign ;
else if ( ! Q_strcasecmp ( end , " lookdown " ) | | ! Q_strcasecmp ( end , " pitchdown " ) )
var - > ival = 2 * sign * - 1 ;
else if ( ! Q_strcasecmp ( end , " moveright " ) )
var - > ival = 3 * sign ;
else if ( ! Q_strcasecmp ( end , " moveleft " ) )
var - > ival = 3 * sign * - 1 ;
else if ( ! Q_strcasecmp ( end , " right " ) | | ! Q_strcasecmp ( end , " turnright " ) )
var - > ival = 4 * sign ;
else if ( ! Q_strcasecmp ( end , " left " ) | | ! Q_strcasecmp ( end , " turnleft " ) )
var - > ival = 4 * sign * 1 ;
else if ( ! Q_strcasecmp ( end , " up " ) | | ! Q_strcasecmp ( end , " moveup " ) )
var - > ival = 5 * sign ;
else if ( ! Q_strcasecmp ( end , " down " ) | | ! Q_strcasecmp ( end , " movedown " ) )
var - > ival = 5 * sign * - 1 ;
else if ( ! Q_strcasecmp ( end , " rollright " ) )
2015-11-18 07:37:39 +00:00
var - > ival = 6 * sign ;
2017-09-20 11:27:13 +00:00
else if ( ! Q_strcasecmp ( end , " rollleft " ) )
2015-11-18 07:37:39 +00:00
var - > ival = 6 * sign * - 1 ;
}
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 10:56:18 +00:00
static cvar_t joy_advaxis [ 6 ] =
{
2016-02-10 23:23:43 +00:00
# define ADVAXISDESC (const char *)"Provides a way to remap each joystick / controller axis.\nShould be set to one of: moveforward, moveback, lookup, lookdown, turnleft, turnright, moveleft, moveright, moveup, movedown, rollleft, rollright"
2019-07-19 02:13:19 +00:00
CVARCD ( " joyadvaxisx " , " moveright " , joyaxiscallback , ADVAXISDESC ) , //left rightwards axis
2021-07-25 16:12:24 +00:00
CVARCD ( " joyadvaxisy " , " moveback " , joyaxiscallback , ADVAXISDESC ) , //left downwards axis
2019-07-19 02:13:19 +00:00
CVARCD ( " joyadvaxisz " , " " , joyaxiscallback , ADVAXISDESC ) , //typically left trigger (use it as a button)
CVARCD ( " joyadvaxisr " , " turnright " , joyaxiscallback , ADVAXISDESC ) , //right rightwards axis
CVARCD ( " joyadvaxisu " , " lookup " , joyaxiscallback , ADVAXISDESC ) , //right downwards axis
CVARCD ( " joyadvaxisv " , " " , joyaxiscallback , ADVAXISDESC ) //typically right trigger
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 10:56:18 +00:00
} ;
static cvar_t joy_advaxisscale [ 6 ] =
{
2019-04-17 00:50:14 +00:00
# define ADVAXISSCALEDESC "Because joyadvaxisx etc can be added together, this provides a way to rescale or invert an individual axis without affecting another with the same action."
CVARD ( " joyadvaxisx_scale " , " 1.0 " , ADVAXISSCALEDESC ) ,
CVARD ( " joyadvaxisy_scale " , " 1.0 " , ADVAXISSCALEDESC ) ,
CVARD ( " joyadvaxisz_scale " , " 1.0 " , ADVAXISSCALEDESC ) ,
CVARD ( " joyadvaxisr_scale " , " 1.0 " , ADVAXISSCALEDESC ) ,
CVARD ( " joyadvaxisu_scale " , " 1.0 " , ADVAXISSCALEDESC ) ,
CVARD ( " joyadvaxisv_scale " , " 1.0 " , ADVAXISSCALEDESC )
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 10:56:18 +00:00
} ;
static cvar_t joy_anglesens [ 3 ] =
{
2019-04-17 00:50:14 +00:00
# define ANGLESENSDESC "Scaler value for the controller when it is at its most extreme value"
CVARD ( " joypitchsensitivity " , " 0.5 " , ANGLESENSDESC ) ,
2019-12-10 14:50:47 +00:00
CVARD ( " joyyawsensitivity " , " 1.0 " , ANGLESENSDESC ) ,
2019-04-17 00:50:14 +00:00
CVARD ( " joyrollsensitivity " , " 1.0 " , ANGLESENSDESC )
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 10:56:18 +00:00
} ;
static cvar_t joy_movesens [ 3 ] =
{
2018-01-05 01:45:49 +00:00
CVAR ( " joyforwardsensitivity " , " 1.0 " ) ,
2017-05-18 10:24:09 +00:00
CVAR ( " joysidesensitivity " , " 1.0 " ) ,
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 10:56:18 +00:00
CVAR ( " joyupsensitivity " , " 1.0 " )
} ;
//comments on threshholds comes from microsoft's xinput docs.
static cvar_t joy_anglethreshold [ 3 ] =
{
2019-04-17 00:50:14 +00:00
# define ANGLETHRESHOLDDESC "Values reported near the center of the analog joystick / controller are often erroneous and undesired.\nThe joystick threshholds are how much of the total values to ignore."
CVARD ( " joypitchthreshold " , " 0.19 " , ANGLETHRESHOLDDESC ) , //8689/32767 (right thumb)
CVARD ( " joyyawthreshold " , " 0.19 " , ANGLETHRESHOLDDESC ) , //8689/32767 (right thumb)
CVARD ( " joyrollthreshold " , " 0.118 " , ANGLETHRESHOLDDESC ) , //30/255 (trigger)
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 10:56:18 +00:00
} ;
static cvar_t joy_movethreshold [ 3 ] =
{
CVAR ( " joyforwardthreshold " , " 0.17 " ) , //7849/32767 (left thumb)
CVAR ( " joysidethreshold " , " 0.17 " ) , //7849/32767 (left thumb)
CVAR ( " joyupthreshold " , " 0.118 " ) , //30/255 (trigger)
} ;
2018-01-05 01:45:49 +00:00
static cvar_t joy_exponent = CVARD ( " joyexponent " , " 3 " , " Scales joystick/controller sensitivity non-linearly to increase precision in the center. \n A value of 1 is linear. " ) ;
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 10:56:18 +00:00
static cvar_t joy_radialdeadzone = CVARD ( " joyradialdeadzone " , " 1 " , " Treat controller dead zones as a pair, rather than per-axis. " ) ;
2016-07-12 00:40:13 +00:00
2018-06-02 08:55:57 +00:00
# define EVENTQUEUELENGTH 1024
2019-09-04 07:59:40 +00:00
static struct eventlist_s
2012-04-09 19:12:12 +00:00
{
enum
{
IEV_KEYDOWN ,
IEV_KEYRELEASE ,
IEV_MOUSEABS ,
2014-03-30 08:55:06 +00:00
IEV_MOUSEDELTA ,
2017-10-13 17:50:28 +00:00
IEV_JOYAXIS ,
IEV_ACCELEROMETER ,
IEV_GYROSCOPE ,
2012-04-09 19:12:12 +00:00
} type ;
2016-07-21 19:27:59 +00:00
unsigned int devid ;
2012-04-09 19:12:12 +00:00
union
{
struct
{
2012-10-14 09:00:49 +00:00
float x , y , z ;
float tsize ; //the size of the touch
2012-04-09 19:12:12 +00:00
} mouse ;
struct
{
int scancode , unicode ;
} keyboard ;
2014-03-30 08:55:06 +00:00
struct
{
int axis ;
float value ;
} joy ;
2017-10-13 17:50:28 +00:00
struct
{ //metres per second, ish.
float x , y , z ;
} accel ;
struct
{ //these are in radians, not degrees.
float pitch , yaw , roll ;
} gyro ;
2012-04-09 19:12:12 +00:00
} ;
} eventlist [ EVENTQUEUELENGTH ] ;
2019-09-04 07:59:40 +00:00
static volatile int events_avail ; /*volatile to make sure the cc doesn't try leaving these cached in a register*/
static volatile int events_used ;
2012-04-09 19:12:12 +00:00
static struct eventlist_s * in_newevent ( void )
{
if ( events_avail > = events_used + EVENTQUEUELENGTH )
return NULL ;
return & eventlist [ events_avail & ( EVENTQUEUELENGTH - 1 ) ] ;
}
static void in_finishevent ( void )
{
events_avail + + ;
}
# define MAXPOINTERS 8
2019-09-04 07:59:40 +00:00
static struct mouse_s
2012-04-09 19:12:12 +00:00
{
enum
{
2012-10-14 09:00:49 +00:00
M_INVALID ,
M_MOUSE , //using deltas
M_TOUCH //using absolutes
2017-10-25 08:10:35 +00:00
//the only functional difference between touch and tablets is that tablets should draw the cursor when hovering too.
2012-10-14 09:00:49 +00:00
} type ;
2016-07-21 19:27:59 +00:00
unsigned int qdeviceid ; //so we can just use pointers.
2017-10-25 08:10:35 +00:00
vec2_t oldpos ; //last-known-cursor-position
vec2_t heldpos ; //position the cursor was at when the button was held (touch-start pos)
2012-10-14 09:00:49 +00:00
float moveddist ; //how far it has moved while held. this provides us with our emulated mouse1 when they release the press
vec2_t delta ; //how far its moved recently
vec2_t old_delta ; //how far its moved previously, for mouse smoothing
float wheeldelta ;
2017-10-25 08:10:35 +00:00
int held ; //button is held (for touch stuff). 1=mouse movements permitted. 2=mouse1 was sent to the game
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 10:56:18 +00:00
unsigned int updates ; //tracks updates per second
2017-10-25 08:10:35 +00:00
qboolean updated ;
2017-09-20 11:27:13 +00:00
} ptr [ MAXPOINTERS ] ;
2019-09-04 07:59:40 +00:00
static int touchcursor = - 1 ; //the cursor follows whichever finger was most recently pressed in preference to any mouse also on the same system
2017-09-20 11:27:13 +00:00
# define MAXJOYAXIS 6
# define MAXJOYSTICKS 8
2019-09-04 07:59:40 +00:00
static struct joy_s
2017-09-20 11:27:13 +00:00
{
unsigned int qdeviceid ;
float axis [ MAXJOYAXIS ] ;
} joy [ MAXJOYSTICKS ] ;
void IN_Shutdown ( void )
{
INS_Shutdown ( ) ;
}
void IN_ReInit ( void )
{
int i ;
for ( i = 0 ; i < MAXPOINTERS ; i + + )
{
memset ( & ptr [ i ] , 0 , sizeof ( ptr [ i ] ) ) ;
ptr [ i ] . type = M_INVALID ;
ptr [ i ] . qdeviceid = i ;
}
for ( i = 0 ; i < MAXJOYSTICKS ; i + + )
{
memset ( & joy [ i ] , 0 , sizeof ( joy [ i ] ) ) ;
joy [ i ] . qdeviceid = i ;
}
INS_ReInit ( ) ;
}
struct remapctx
{
char * type ;
char * devicename ;
unsigned int newdevid ;
unsigned int found ;
unsigned int failed ;
} ;
static void IN_DeviceIDs_DoRemap ( void * vctx , const char * type , const char * devicename , unsigned int * qdevid )
{
struct remapctx * ctx = vctx ;
2017-10-25 08:10:35 +00:00
if ( ! strcmp ( ctx - > type , type ) | | ! strcmp ( ctx - > type , " * " ) )
if ( ! strcmp ( ctx - > devicename , devicename ) | | ! strcmp ( ctx - > devicename , " * " ) )
2017-09-20 11:27:13 +00:00
{
if ( qdevid )
* qdevid = ctx - > newdevid ;
else
ctx - > failed = true ;
ctx - > found + + ;
}
}
void IN_DeviceIDs_Enumerate ( void * ctx , const char * type , const char * devicename , unsigned int * qdevid )
{
char buf [ 8192 ] ;
devicename = COM_QuotedString ( devicename , buf , sizeof ( buf ) , false ) ;
if ( ! qdevid )
Con_Printf ( " %s \t %s \t %s \n " , type , " N/A " , devicename ) ;
else if ( * qdevid = = DEVID_UNSET )
Con_Printf ( " %s \t %s \t %s \n " , type , " Unset " , devicename ) ;
else
Con_Printf ( " %s \t %u \t %s \n " , type , * qdevid , devicename ) ;
}
void IN_DeviceIDs_f ( void )
{
struct remapctx ctx ;
if ( Cmd_Argc ( ) > 3 )
{
ctx . failed = false ;
ctx . found = 0 ;
ctx . type = Cmd_Argv ( 1 ) ;
ctx . newdevid = strtoul ( Cmd_Argv ( 2 ) , NULL , 0 ) ;
ctx . devicename = Cmd_Argv ( 3 ) ;
INS_EnumerateDevices ( & ctx , IN_DeviceIDs_DoRemap ) ;
if ( ctx . failed )
Con_Printf ( " device cannot be remapped \n " ) ;
else if ( ! ctx . found )
Con_Printf ( " %s \" %s \" not known \n " , ctx . type , ctx . devicename ) ;
else if ( ! cl_warncmd . ival )
Con_Printf ( " device remapped \n " ) ;
}
2017-10-25 08:10:35 +00:00
else if ( Cmd_Argc ( ) > 1 )
{
Con_Printf ( " %s TYPE NEWID DEVICENAME \n " , Cmd_Argv ( 0 ) ) ;
}
2017-09-20 11:27:13 +00:00
else
{
Con_Printf ( " Type \t Mapping \t Name \n " ) ;
INS_EnumerateDevices ( NULL , IN_DeviceIDs_Enumerate ) ;
}
}
float IN_DetermineMouseRate ( void )
{
2021-07-03 23:33:59 +00:00
double time = Sys_DoubleTime ( ) ;
static double timer ;
2017-09-20 11:27:13 +00:00
static float last ;
2021-07-03 23:33:59 +00:00
float interval = time - timer ;
if ( fabs ( interval ) > = 1 )
2017-09-20 11:27:13 +00:00
{
timer = time ;
2021-07-03 23:33:59 +00:00
last = ptr [ 0 ] . updates / interval ;
2017-09-20 11:27:13 +00:00
ptr [ 0 ] . updates = 0 ;
}
return last ;
}
void IN_Init ( void )
{
int i ;
2014-03-30 08:55:06 +00:00
events_avail = 0 ;
2017-09-20 11:27:13 +00:00
events_used = 0 ;
Cvar_Register ( & m_filter , " input controls " ) ;
2012-10-14 09:00:49 +00:00
Cvar_Register ( & m_forcewheel , " Input Controls " ) ;
2017-09-20 11:27:13 +00:00
Cvar_Register ( & m_forcewheel_threshold , " Input Controls " ) ;
2018-06-06 09:09:14 +00:00
Cvar_Register ( & m_touchstrafe , " input controls " ) ;
2017-09-20 11:27:13 +00:00
Cvar_Register ( & m_fatpressthreshold , " input controls " ) ;
Cvar_Register ( & m_slidethreshold , " input controls " ) ;
Cvar_Register ( & m_touchmajoraxis , " input controls " ) ;
Cvar_Register ( & m_accel , " input controls " ) ;
Cvar_Register ( & m_accel_style , " input controls " ) ;
Cvar_Register ( & m_accel_power , " input controls " ) ;
Cvar_Register ( & m_accel_offset , " input controls " ) ;
Cvar_Register ( & m_accel_senscap , " input controls " ) ;
for ( i = 0 ; i < 6 ; i + + )
{
Cvar_Register ( & joy_advaxis [ i ] , " input controls " ) ;
Cvar_Register ( & joy_advaxisscale [ i ] , " input controls " ) ;
Cvar_ForceCallback ( & joy_advaxis [ i ] ) ;
}
for ( i = 0 ; i < 3 ; i + + )
{
Cvar_Register ( & joy_anglesens [ i ] , " input controls " ) ;
Cvar_Register ( & joy_movesens [ i ] , " input controls " ) ;
Cvar_Register ( & joy_anglethreshold [ i ] , " input controls " ) ;
Cvar_Register ( & joy_movethreshold [ i ] , " input controls " ) ;
}
Cvar_Register ( & joy_exponent , " input controls " ) ;
Cvar_Register ( & joy_radialdeadzone , " input controls " ) ;
Cmd_AddCommand ( " in_deviceids " , IN_DeviceIDs_f ) ;
INS_Init ( ) ;
}
//tells the keys.c code whether the cursor is currently active, causing mouse clicks instead of binds.
qboolean IN_MouseDevIsTouch ( unsigned int devid )
{
if ( devid < MAXPOINTERS )
return ptr [ devid ] . type = = M_TOUCH ;
return false ;
}
//there was no ui to click on at least...
//translates MOUSE1 press events into begin-look-or-strafe events.
//translates to MOUSE2 accordingly
//returns 0 if it ate it completely.
int IN_TranslateMButtonPress ( unsigned int devid )
{
int ret ;
2017-10-25 08:10:35 +00:00
if ( ! ptr [ devid ] . held )
2017-09-20 11:27:13 +00:00
{
//set the cursor-pressed state, so we begin to look/strafe around
2017-10-25 08:10:35 +00:00
ptr [ devid ] . held = 1 ;
2014-03-30 08:55:06 +00:00
ptr [ devid ] . moveddist = 0 ;
2017-10-25 08:10:35 +00:00
ptr [ devid ] . heldpos [ 0 ] = ptr [ devid ] . oldpos [ 0 ] ;
ptr [ devid ] . heldpos [ 1 ] = ptr [ devid ] . oldpos [ 1 ] ;
2014-03-30 08:55:06 +00:00
ptr [ devid ] . delta [ 0 ] = 0 ;
ptr [ devid ] . delta [ 1 ] = 0 ;
ret = 0 ; //eat it
}
else
{
2018-06-06 09:09:14 +00:00
//translate touch to mouse2 if its on the strafing side of the screen.
switch ( m_touchstrafe . ival )
{
case 2 :
ret = ptr [ devid ] . heldpos [ 0 ] < vid . pixelwidth / 2 ;
break ;
default :
ret = ptr [ devid ] . heldpos [ 0 ] > vid . pixelwidth / 2 ;
break ;
case 0 :
ret = false ;
break ;
}
ret = ret ? K_MOUSE2 : K_MOUSE1 ;
2014-03-30 08:55:06 +00:00
}
2017-09-20 11:27:13 +00:00
return ret ;
}
/*a 'pointer' is either a multitouch pointer, or a separate device
note that mice use the keyboard button api , but separate devices */
void IN_Commands ( void )
{
2012-10-14 09:00:49 +00:00
struct eventlist_s * ev ;
2012-04-24 07:59:11 +00:00
2012-10-14 09:00:49 +00:00
INS_Commands ( ) ;
2012-04-09 19:12:12 +00:00
while ( events_used ! = events_avail )
{
ev = & eventlist [ events_used & ( EVENTQUEUELENGTH - 1 ) ] ;
2014-09-02 06:01:03 +00:00
2012-04-09 19:12:12 +00:00
switch ( ev - > type )
{
case IEV_KEYRELEASE :
2018-12-20 00:57:15 +00:00
if ( ev - > keyboard . scancode = = - 1 )
{
int i ;
for ( i = 0 ; i < K_MAX ; i + + )
Key_Event ( ev - > devid , i , 0 , false ) ;
break ;
}
case IEV_KEYDOWN :
2017-10-25 08:10:35 +00:00
//Con_Printf("IEV_KEY%s %i: %i '%c'\n", (ev->type==IEV_KEYDOWN)?"DOWN":"RELEASE", ev->devid, ev->keyboard.scancode, ev->keyboard.unicode?ev->keyboard.unicode:' ');
2012-10-14 09:00:49 +00:00
//on touchscreens, mouse1 is used as up/down state. we have to emulate actual mouse clicks based upon distance moved, so we can get movement events.
if ( ev - > keyboard . scancode = = K_MOUSE1 & & ev - > devid < MAXPOINTERS & & ( ptr [ ev - > devid ] . type = = M_TOUCH ) )
2012-04-09 19:12:12 +00:00
{
2014-09-02 06:01:03 +00:00
if ( ev - > type = = IEV_KEYDOWN )
{
float fl ;
touchcursor = ev - > devid ;
fl = ptr [ ev - > devid ] . oldpos [ 0 ] * vid . width / vid . pixelwidth ;
mousecursor_x = bound ( 0 , fl , vid . width - 1 ) ;
fl = ptr [ ev - > devid ] . oldpos [ 1 ] * vid . height / vid . pixelheight ;
mousecursor_y = bound ( 0 , fl , vid . height - 1 ) ;
}
else if ( touchcursor = = ev - > devid )
2017-10-25 08:10:35 +00:00
touchcursor = - 1 ; //revert it to the mouse, or whatever device was 0.
2014-09-02 06:01:03 +00:00
2012-04-09 19:12:12 +00:00
if ( Key_MouseShouldBeFree ( ) )
2017-10-25 08:10:35 +00:00
ptr [ ev - > devid ] . held = 0 ;
else if ( ptr [ ev - > devid ] . held )
2012-04-09 19:12:12 +00:00
{
if ( ev - > type = = IEV_KEYDOWN )
2014-03-30 08:55:06 +00:00
Key_Event ( ev - > devid , ev - > keyboard . scancode , ev - > keyboard . unicode , ev - > type = = IEV_KEYDOWN ) ;
2012-04-09 19:12:12 +00:00
else
{
2017-10-25 08:10:35 +00:00
if ( ptr [ ev - > devid ] . held = = 1 & & ptr [ ev - > devid ] . moveddist < m_slidethreshold . value )
2012-10-14 09:00:49 +00:00
{
2017-10-25 08:10:35 +00:00
ptr [ ev - > devid ] . held = 2 ; //so we don't just flag it as held again
2014-03-30 08:55:06 +00:00
Key_Event ( ev - > devid , K_MOUSE1 , 0 , true ) ;
2012-04-09 19:12:12 +00:00
}
2014-03-30 08:55:06 +00:00
Key_Event ( ev - > devid , K_MOUSE1 , 0 , false ) ;
2017-10-25 08:10:35 +00:00
ptr [ ev - > devid ] . held = 0 ;
2012-04-09 19:12:12 +00:00
}
break ;
}
}
Key_Event ( ev - > devid , ev - > keyboard . scancode , ev - > keyboard . unicode , ev - > type = = IEV_KEYDOWN ) ;
break ;
2014-03-30 08:55:06 +00:00
case IEV_JOYAXIS :
2014-09-02 06:01:03 +00:00
if ( ev - > devid < MAXJOYSTICKS & & ev - > joy . axis < MAXJOYAXIS )
{
2019-09-04 07:59:40 +00:00
if ( topmenu & & topmenu - > joyaxis & & topmenu - > joyaxis ( topmenu , ev - > devid , ev - > joy . axis , ev - > joy . value ) )
2016-11-02 08:01:21 +00:00
joy [ ev - > devid ] . axis [ ev - > joy . axis ] = 0 ;
else
2014-06-27 16:19:22 +00:00
# ifdef CSQC_DAT
2014-09-02 06:01:03 +00:00
if ( CSQC_JoystickAxis ( ev - > joy . axis , ev - > joy . value , ev - > devid ) )
joy [ ev - > devid ] . axis [ ev - > joy . axis ] = 0 ;
else
2014-06-27 16:19:22 +00:00
# endif
2014-09-02 06:01:03 +00:00
joy [ ev - > devid ] . axis [ ev - > joy . axis ] = ev - > joy . value ;
}
2014-03-30 08:55:06 +00:00
break ;
2012-10-14 09:00:49 +00:00
case IEV_MOUSEDELTA :
2017-10-25 08:10:35 +00:00
//Con_Printf("IEV_MOUSEDELTA %i: %f %f\n", ev->devid, ev->mouse.x, ev->mouse.y);
2012-10-14 09:00:49 +00:00
if ( ev - > devid < MAXPOINTERS )
{
2017-10-25 08:10:35 +00:00
if ( ev - > mouse . x | | ev - > mouse . y )
ptr [ ev - > devid ] . updated = true ;
2012-10-14 09:00:49 +00:00
if ( ptr [ ev - > devid ] . type ! = M_MOUSE )
{
ptr [ ev - > devid ] . type = M_MOUSE ;
}
ptr [ ev - > devid ] . delta [ 0 ] + = ev - > mouse . x ;
ptr [ ev - > devid ] . delta [ 1 ] + = ev - > mouse . y ;
2017-10-25 08:10:35 +00:00
//if we're emulating a cursor, make sure that's updated too.
if ( touchcursor < 0 & & Key_MouseShouldBeFree ( ) )
{
mousecursor_x + = ev - > mouse . x ;
mousecursor_y + = ev - > mouse . y ;
mousecursor_x = bound ( 0 , mousecursor_x , vid . pixelwidth - 1 ) ;
mousecursor_y = bound ( 0 , mousecursor_y , vid . pixelheight - 1 ) ;
}
ptr [ ev - > devid ] . oldpos [ 0 ] = mousecursor_x ;
ptr [ ev - > devid ] . oldpos [ 1 ] = mousecursor_y ;
2012-10-14 09:00:49 +00:00
if ( m_forcewheel . value > = 2 )
ptr [ ev - > devid ] . wheeldelta - = ev - > mouse . z ;
else if ( m_forcewheel . value )
{
int mfwt = ( int ) m_forcewheel_threshold . value ;
if ( ev - > mouse . z > mfwt )
ptr [ ev - > devid ] . wheeldelta - = mfwt ;
else if ( ev - > mouse . z < - mfwt )
ptr [ ev - > devid ] . wheeldelta + = mfwt ;
}
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 10:56:18 +00:00
if ( ev - > mouse . x | | ev - > mouse . y )
ptr [ ev - > devid ] . updates + + ;
2012-10-14 09:00:49 +00:00
}
break ;
2012-04-09 19:12:12 +00:00
case IEV_MOUSEABS :
2017-10-25 08:10:35 +00:00
//Con_Printf("IEV_MOUSEABS %i: %f %f\n", ev->devid, ev->mouse.x, ev->mouse.y);
2012-04-09 19:12:12 +00:00
/*mouse cursors only really work with one pointer*/
2017-10-25 08:10:35 +00:00
if ( ev - > devid = = touchcursor | | ( touchcursor < 0 & & ev - > devid < MAXPOINTERS & & ( ptr [ ev - > devid ] . oldpos [ 0 ] ! = ev - > mouse . x | | ptr [ ev - > devid ] . oldpos [ 1 ] ! = ev - > mouse . y ) ) )
2012-04-09 19:12:12 +00:00
{
2012-10-14 09:00:49 +00:00
float fl ;
fl = ev - > mouse . x * vid . width / vid . pixelwidth ;
mousecursor_x = bound ( 0 , fl , vid . width - 1 ) ;
fl = ev - > mouse . y * vid . height / vid . pixelheight ;
mousecursor_y = bound ( 0 , fl , vid . height - 1 ) ;
2012-04-09 19:12:12 +00:00
}
if ( ev - > devid < MAXPOINTERS )
{
2012-10-14 09:00:49 +00:00
if ( ptr [ ev - > devid ] . type ! = M_TOUCH )
{
//if its now become an absolute device, clear stuff so we don't get confused.
ptr [ ev - > devid ] . type = M_TOUCH ;
2017-10-25 08:10:35 +00:00
ptr [ ev - > devid ] . held = 0 ;
2012-10-14 09:00:49 +00:00
ptr [ ev - > devid ] . moveddist = 0 ;
ptr [ ev - > devid ] . oldpos [ 0 ] = ev - > mouse . x ;
ptr [ ev - > devid ] . oldpos [ 1 ] = ev - > mouse . y ;
}
2017-10-25 08:10:35 +00:00
if ( ptr [ ev - > devid ] . held )
2012-10-14 09:00:49 +00:00
{
ptr [ ev - > devid ] . delta [ 0 ] + = ev - > mouse . x - ptr [ ev - > devid ] . oldpos [ 0 ] ;
ptr [ ev - > devid ] . delta [ 1 ] + = ev - > mouse . y - ptr [ ev - > devid ] . oldpos [ 1 ] ;
ptr [ ev - > devid ] . moveddist + = fabs ( ev - > mouse . x - ptr [ ev - > devid ] . oldpos [ 0 ] ) + fabs ( ev - > mouse . y - ptr [ ev - > devid ] . oldpos [ 1 ] ) ;
}
2012-04-09 19:12:12 +00:00
2017-10-25 08:10:35 +00:00
if ( ev - > mouse . x ! = ptr [ ev - > devid ] . oldpos [ 0 ] | |
ev - > mouse . y ! = ptr [ ev - > devid ] . oldpos [ 1 ] )
{
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 10:56:18 +00:00
ptr [ ev - > devid ] . updates + + ;
2017-10-25 08:10:35 +00:00
ptr [ ev - > devid ] . updated = true ;
}
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 10:56:18 +00:00
2012-04-09 19:12:12 +00:00
ptr [ ev - > devid ] . oldpos [ 0 ] = ev - > mouse . x ;
ptr [ ev - > devid ] . oldpos [ 1 ] = ev - > mouse . y ;
2017-10-25 08:10:35 +00:00
if ( ptr [ ev - > devid ] . held > 1 & & ev - > mouse . tsize < m_fatpressthreshold . value )
2012-10-14 09:00:49 +00:00
{
2017-10-25 08:10:35 +00:00
ptr [ ev - > devid ] . held = 1 ;
2014-03-30 08:55:06 +00:00
Key_Event ( ev - > devid , K_MOUSE1 , 0 , false ) ;
2012-10-14 09:00:49 +00:00
}
2017-10-25 08:10:35 +00:00
if ( ptr [ ev - > devid ] . held = = 1 & & ev - > mouse . tsize > m_fatpressthreshold . value )
2012-10-14 09:00:49 +00:00
{
2017-10-25 08:10:35 +00:00
ptr [ ev - > devid ] . held = 2 ;
2014-03-30 08:55:06 +00:00
Key_Event ( ev - > devid , K_MOUSE1 , 0 , true ) ;
2012-10-14 09:00:49 +00:00
}
2012-04-09 19:12:12 +00:00
}
break ;
2017-10-13 17:50:28 +00:00
case IEV_ACCELEROMETER :
//down: x= +9.8
//left: y= -9.8
//up: z= +9.8
2017-10-31 22:52:58 +00:00
# ifdef CSQC_DAT
2017-10-13 17:50:28 +00:00
CSQC_Accelerometer ( ev - > accel . x , ev - > accel . y , ev - > accel . z ) ;
2017-10-31 22:52:58 +00:00
# endif
2017-10-13 17:50:28 +00:00
break ;
case IEV_GYROSCOPE :
2017-10-31 22:52:58 +00:00
# ifdef CSQC_DAT
2017-10-13 17:50:28 +00:00
CSQC_Gyroscope ( ev - > gyro . pitch * 180.0 / M_PI , ev - > gyro . yaw * 180.0 / M_PI , ev - > gyro . roll * 180.0 / M_PI ) ;
2017-10-31 22:52:58 +00:00
# endif
2017-10-13 17:50:28 +00:00
break ;
2012-04-09 19:12:12 +00:00
}
events_used + + ;
2017-09-20 11:27:13 +00:00
}
}
void IN_MoveMouse ( struct mouse_s * mouse , float * movements , int pnum , float frametime )
2012-10-14 09:00:49 +00:00
{
2017-11-23 07:46:39 +00:00
float mx , my ;
2012-10-14 09:00:49 +00:00
double mouse_x , mouse_y , mouse_deltadist ;
int mfwt ;
qboolean strafe_x , strafe_y ;
int wpnum ;
2018-03-24 04:02:09 +00:00
# ifdef CSQC_DAT
2016-02-15 06:01:17 +00:00
# ifdef MULTITHREAD
2015-10-11 11:34:58 +00:00
extern qboolean runningindepphys ;
2016-02-15 06:01:17 +00:00
# else
const qboolean runningindepphys = false ;
# endif
# endif
2012-04-09 19:12:12 +00:00
2012-10-14 09:00:49 +00:00
//small performance boost
if ( mouse - > type = = M_INVALID )
return ;
2012-04-09 19:12:12 +00:00
2012-10-14 09:00:49 +00:00
/*each device will be processed when its player comes to be processed*/
wpnum = cl . splitclients ;
if ( wpnum < 1 )
wpnum = 1 ;
2015-03-03 00:14:43 +00:00
if ( cl_forceseat . ival )
wpnum = ( cl_forceseat . ival - 1 ) % wpnum ;
2012-10-14 09:00:49 +00:00
else
wpnum = mouse - > qdeviceid % wpnum ;
if ( wpnum ! = pnum )
return ;
2012-04-09 19:12:12 +00:00
2012-10-14 09:00:49 +00:00
if ( m_forcewheel . value )
2012-04-09 19:12:12 +00:00
{
2012-10-14 09:00:49 +00:00
mfwt = m_forcewheel_threshold . ival ;
if ( mfwt )
2012-04-09 19:12:12 +00:00
{
2012-10-14 09:00:49 +00:00
while ( mouse - > wheeldelta < = - mfwt )
2012-04-09 19:12:12 +00:00
{
2012-10-14 09:00:49 +00:00
Key_Event ( mouse - > qdeviceid , K_MWHEELUP , 0 , true ) ;
Key_Event ( mouse - > qdeviceid , K_MWHEELUP , 0 , false ) ;
mouse - > wheeldelta + = mfwt ;
}
while ( mouse - > wheeldelta > = mfwt )
{
Key_Event ( mouse - > qdeviceid , K_MWHEELDOWN , 0 , true ) ;
Key_Event ( mouse - > qdeviceid , K_MWHEELDOWN , 0 , false ) ;
mouse - > wheeldelta - = mfwt ;
2012-04-09 19:12:12 +00:00
}
}
2012-10-14 09:00:49 +00:00
if ( m_forcewheel . value < 2 )
mouse - > wheeldelta = 0 ;
}
2012-04-09 19:12:12 +00:00
2012-10-14 09:00:49 +00:00
mx = mouse - > delta [ 0 ] ;
mouse - > delta [ 0 ] = 0 ;
my = mouse - > delta [ 1 ] ;
mouse - > delta [ 1 ] = 0 ;
2012-04-09 19:12:12 +00:00
2012-10-14 09:00:49 +00:00
if ( in_xflip . value ) mx * = - 1 ;
2012-04-09 19:12:12 +00:00
2012-10-14 09:00:49 +00:00
mousemove_x + = mx ;
mousemove_y + = my ;
2012-04-09 19:12:12 +00:00
2012-10-14 09:00:49 +00:00
if ( Key_MouseShouldBeFree ( ) )
2017-10-25 08:10:35 +00:00
mx = my = 0 ;
2012-04-09 19:12:12 +00:00
2012-10-14 09:00:49 +00:00
if ( mouse - > type = = M_TOUCH )
2012-04-09 19:12:12 +00:00
{
2018-06-06 09:09:14 +00:00
qboolean strafing = false ;
switch ( m_touchstrafe . ival )
{
case 2 :
strafing = mouse - > heldpos [ 0 ] < vid . pixelwidth / 2 ;
break ;
default :
strafing = mouse - > heldpos [ 0 ] > vid . pixelwidth / 2 ;
break ;
case 0 :
strafing = true ;
break ;
}
if ( strafing & & movements ! = NULL & & ! Key_Dest_Has ( ~ kdm_game ) )
2017-09-20 11:27:13 +00:00
{
//if they're strafing, calculate the speed to move at based upon their displacement
2017-10-25 08:10:35 +00:00
if ( mouse - > held )
2017-09-20 11:27:13 +00:00
{
2019-04-15 18:43:42 +00:00
if ( m_touchstrafe . ival = = 2 ) //left side
2018-06-06 09:09:14 +00:00
mx = mouse - > oldpos [ 0 ] - ( vid . pixelwidth * 1 ) / 4.0 ;
else //right side
mx = mouse - > oldpos [ 0 ] - ( vid . pixelwidth * 3 ) / 4.0 ;
2017-11-23 07:46:39 +00:00
my = mouse - > oldpos [ 1 ] - ( vid . pixelheight * 3 ) / 4.0 ;
2017-09-20 11:27:13 +00:00
2017-10-25 08:10:35 +00:00
//mx = (mouse->oldpos[0] - mouse->heldpos[0])*0.1;
//my = (mouse->oldpos[1] - mouse->heldpos[1])*0.1;
2017-09-20 11:27:13 +00:00
}
else
{
mx = 0 ;
my = 0 ;
}
if ( m_touchmajoraxis . ival )
{
//major axis only
2017-11-23 07:46:39 +00:00
if ( fabs ( mx ) > fabs ( my ) )
2017-09-20 11:27:13 +00:00
my = 0 ;
else
mx = 0 ;
}
strafe_x = true ;
strafe_y = true ;
}
else
{
strafe_x = false ;
2012-10-14 09:00:49 +00:00
strafe_y = false ;
2014-02-07 08:38:40 +00:00
//boost sensitivity so that the default works okay.
mx * = 1.75 ;
my * = 1.75 ;
2012-10-14 09:00:49 +00:00
}
2012-04-09 19:12:12 +00:00
}
2012-10-14 09:00:49 +00:00
else
2012-04-09 19:12:12 +00:00
{
2012-10-14 09:00:49 +00:00
strafe_x = ( in_strafe . state [ pnum ] & 1 ) | | ( lookstrafe . value & & ( in_mlook . state [ pnum ] & 1 ) ) ;
strafe_y = ! ( ( in_mlook . state [ pnum ] & 1 ) & & ! ( in_strafe . state [ pnum ] & 1 ) ) ;
2012-04-09 19:12:12 +00:00
}
2017-10-25 08:10:35 +00:00
if ( mouse - > type = = M_TOUCH | | Key_MouseShouldBeFree ( ) )
2012-04-09 19:12:12 +00:00
{
2017-10-25 08:10:35 +00:00
if ( mouse - > updated )
{ //many mods assume only a single mouse device.
//when we have multiple active abs devices, we need to avoid sending all of them, because that just confuses everyone. such mods will see only devices that are actually moving, so uni-cursor mods will see only the one that moved most recently.
mouse - > updated = false ;
2018-05-21 13:47:53 +00:00
if ( ! runningindepphys )
2017-10-25 08:10:35 +00:00
{
2019-09-04 07:59:40 +00:00
if ( ( promptmenu & & promptmenu - > mousemove & & promptmenu - > mousemove ( topmenu , true , mouse - > qdeviceid , mouse - > oldpos [ 0 ] , mouse - > oldpos [ 1 ] ) ) | |
( topmenu & & topmenu - > mousemove & & topmenu - > mousemove ( topmenu , true , mouse - > qdeviceid , mouse - > oldpos [ 0 ] , mouse - > oldpos [ 1 ] ) ) )
2018-05-21 13:47:53 +00:00
{
mx = 0 ;
my = 0 ;
}
2018-03-24 04:02:09 +00:00
# ifdef CSQC_DAT
2018-05-21 13:47:53 +00:00
if ( ! runningindepphys & & CSQC_MousePosition ( mouse - > oldpos [ 0 ] , mouse - > oldpos [ 1 ] , mouse - > qdeviceid ) )
{
mx = 0 ;
my = 0 ;
}
2016-11-02 08:01:21 +00:00
# endif
2018-05-21 13:47:53 +00:00
}
2017-10-25 08:10:35 +00:00
}
2013-06-23 02:17:02 +00:00
}
else
{
2019-09-04 07:59:40 +00:00
if ( Key_Dest_Has ( kdm_menu ) )
2016-11-02 08:01:21 +00:00
if ( mx | | my )
2019-09-04 07:59:40 +00:00
if ( ! runningindepphys & & topmenu & & topmenu - > mousemove & & topmenu - > mousemove ( topmenu , false , mouse - > qdeviceid , mx , my ) )
2016-11-02 08:01:21 +00:00
{
mx = 0 ;
my = 0 ;
}
2018-03-24 04:02:09 +00:00
# ifdef CSQC_DAT
2014-03-30 08:55:06 +00:00
if ( mx | | my )
2015-10-11 11:34:58 +00:00
if ( ! runningindepphys & & CSQC_MouseMove ( mx , my , mouse - > qdeviceid ) )
2013-10-08 14:28:11 +00:00
{
mx = 0 ;
my = 0 ;
}
2016-11-02 08:01:21 +00:00
# endif
2013-10-08 14:28:11 +00:00
2014-03-30 08:55:06 +00:00
//if game is not focused, kill any mouse look
if ( Key_Dest_Has ( ~ kdm_game ) )
2013-06-23 02:17:02 +00:00
{
mx = 0 ;
my = 0 ;
}
2012-10-14 09:00:49 +00:00
}
2012-04-09 19:12:12 +00:00
2012-10-14 09:00:49 +00:00
if ( m_filter . value )
{
double fraction = bound ( 0 , m_filter . value , 2 ) * 0.5 ;
mouse_x = ( mx * ( 1 - fraction ) + mouse - > old_delta [ 0 ] * fraction ) ;
mouse_y = ( my * ( 1 - fraction ) + mouse - > old_delta [ 1 ] * fraction ) ;
}
else
{
mouse_x = mx ;
mouse_y = my ;
}
2012-04-09 19:12:12 +00:00
2012-10-14 09:00:49 +00:00
mouse - > old_delta [ 0 ] = mx ;
mouse - > old_delta [ 1 ] = my ;
if ( m_accel . value )
{
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
if ( m_accel_style . ival & & frametime )
2016-02-10 23:23:43 +00:00
{
float accelsens = sensitivity . value * in_sensitivityscale ;
float mousespeed = ( sqrt ( mx * mx + my * my ) ) / ( 1000.0f * ( float ) frametime ) ;
mousespeed - = m_accel_offset . value ;
if ( mousespeed > 0 )
{
mousespeed * = m_accel . value ;
if ( m_accel_power . value > 1 )
accelsens + = exp ( ( m_accel_power . value - 1 ) * log ( mousespeed ) ) ;
else
accelsens = 1 ;
}
if ( m_accel_senscap . value > 0 & & accelsens > m_accel_senscap . value )
accelsens = m_accel_senscap . value ;
mouse_x * = accelsens ;
mouse_y * = accelsens ;
}
else
{
mouse_deltadist = sqrt ( mx * mx + my * my ) ;
mouse_x * = ( mouse_deltadist * m_accel . value + sensitivity . value * in_sensitivityscale ) ;
mouse_y * = ( mouse_deltadist * m_accel . value + sensitivity . value * in_sensitivityscale ) ;
}
2012-10-14 09:00:49 +00:00
}
else
{
mouse_x * = sensitivity . value * in_sensitivityscale ;
mouse_y * = sensitivity . value * in_sensitivityscale ;
2012-04-09 19:12:12 +00:00
}
2017-08-29 02:29:06 +00:00
/*
2015-09-01 04:45:15 +00:00
# ifdef QUAKESTATS
2017-07-04 05:07:51 +00:00
if ( cl . playerview [ pnum ] . statsf [ STAT_VIEWZOOM ] )
2012-10-14 09:00:49 +00:00
{
2017-07-12 08:15:27 +00:00
mouse_x * = cl . playerview [ pnum ] . statsf [ STAT_VIEWZOOM ] / STAT_VIEWZOOM_SCALE ;
mouse_y * = cl . playerview [ pnum ] . statsf [ STAT_VIEWZOOM ] / STAT_VIEWZOOM_SCALE ;
2012-10-14 09:00:49 +00:00
}
2015-09-01 04:45:15 +00:00
# endif
2017-08-29 02:29:06 +00:00
*/
2012-04-09 19:12:12 +00:00
2012-10-14 09:00:49 +00:00
if ( ! movements )
{
return ;
}
2012-04-09 19:12:12 +00:00
2012-10-14 09:00:49 +00:00
// add mouse X/Y movement to cmd
if ( strafe_x )
movements [ 1 ] + = m_side . value * mouse_x ;
else
{
// if ((int)((cl.viewangles[pnum][PITCH]+89.99)/180) & 1)
// mouse_x *= -1;
cl . playerview [ pnum ] . viewanglechange [ YAW ] - = m_yaw . value * mouse_x ;
}
2012-04-09 19:12:12 +00:00
2012-10-14 09:00:49 +00:00
if ( in_mlook . state [ pnum ] & 1 )
2013-06-23 02:17:02 +00:00
V_StopPitchDrift ( & cl . playerview [ pnum ] ) ;
2012-04-09 19:12:12 +00:00
2012-10-14 09:00:49 +00:00
if ( ! strafe_y )
{
cl . playerview [ pnum ] . viewanglechange [ PITCH ] + = m_pitch . value * mouse_y ;
}
else
{
if ( ( in_strafe . state [ pnum ] & 1 ) & & noclip_anglehack )
movements [ 2 ] - = m_forward . value * mouse_y ;
else
movements [ 0 ] - = m_forward . value * mouse_y ;
}
2017-09-20 11:27:13 +00:00
}
//rescales threshold-1 down 0-1
static float joydeadzone ( float mag , float deadzone )
{
if ( mag > 1 ) //erg?
mag = 1 ;
if ( mag > deadzone )
{
mag - = deadzone ;
mag = mag / ( 1.f - deadzone ) ;
}
else
mag = 0 ;
return mag ;
}
void IN_MoveJoystick ( struct joy_s * joy , float * movements , int pnum , float frametime )
{
float mag ;
vec3_t jlook , jstrafe ;
int wpnum , i ;
for ( i = 0 ; i < MAXJOYAXIS ; i + + )
if ( joy - > axis [ i ] )
break ;
if ( i = = MAXJOYAXIS )
return ;
2014-03-30 08:55:06 +00:00
/*each device will be processed when its player comes to be processed*/
wpnum = cl . splitclients ;
if ( wpnum < 1 )
wpnum = 1 ;
2015-03-03 00:14:43 +00:00
if ( cl_forceseat . ival )
wpnum = ( cl_forceseat . ival - 1 ) % wpnum ;
2014-03-30 08:55:06 +00:00
else
wpnum = joy - > qdeviceid % wpnum ;
if ( wpnum ! = pnum )
2017-09-20 11:27:13 +00:00
return ;
memset ( jstrafe , 0 , sizeof ( jstrafe ) ) ;
memset ( jlook , 0 , sizeof ( jlook ) ) ;
for ( i = 0 ; i < 6 ; i + + )
{
int ax = joy_advaxis [ i ] . ival ;
switch ( ax )
{
default :
case 0 : //dead axis
break ;
case 1 :
case 3 :
case 5 :
jstrafe [ ( ax - 1 ) / 2 ] + = joy - > axis [ i ] * joy_advaxisscale [ i ] . value ;
break ;
case - 1 :
case - 3 :
case - 5 :
jstrafe [ ( - ax - 1 ) / 2 ] - = joy - > axis [ i ] * joy_advaxisscale [ i ] . value ;
case 2 :
case 4 :
case 6 :
jlook [ ( ax - 2 ) / 2 ] + = joy - > axis [ i ] * joy_advaxisscale [ i ] . value ;
break ;
case - 2 :
case - 4 :
case - 6 :
jlook [ ( - ax - 2 ) / 2 ] - = joy - > axis [ i ] * joy_advaxisscale [ i ] . value ;
break ;
}
}
//uses a radial deadzone for x+y axis, and separate out the z axis, just because most controllers are 2d affairs with any 3rd axis being a separate knob.
//deadzone values are stolen from microsoft's xinput documentation. they seem quite large to me - I guess that means that xbox controllers are just dodgy imprecise crap with excessive amounts of friction and finger grease.
if ( joy_radialdeadzone . ival )
{
mag = joydeadzone ( sqrt ( jlook [ 0 ] * jlook [ 0 ] + jlook [ 1 ] * jlook [ 1 ] ) , sqrt ( joy_anglethreshold [ 0 ] . value * joy_anglethreshold [ 0 ] . value + joy_anglethreshold [ 1 ] . value * joy_anglethreshold [ 1 ] . value ) ) ;
mag = pow ( mag , joy_exponent . value ) ;
jlook [ 0 ] * = mag ;
jlook [ 1 ] * = mag ;
2020-09-08 05:11:09 +00:00
2017-09-20 11:27:13 +00:00
mag = joydeadzone ( fabs ( jlook [ 2 ] ) , joy_anglethreshold [ 2 ] . value ) ;
2020-09-08 05:11:09 +00:00
mag = pow ( mag , joy_exponent . value ) ;
2017-09-20 11:27:13 +00:00
jlook [ 2 ] * = mag ;
mag = joydeadzone ( sqrt ( jstrafe [ 0 ] * jstrafe [ 0 ] + jstrafe [ 1 ] * jstrafe [ 1 ] ) , sqrt ( joy_movethreshold [ 0 ] . value * joy_movethreshold [ 0 ] . value + joy_movethreshold [ 1 ] . value * joy_movethreshold [ 1 ] . value ) ) ;
mag = pow ( mag , joy_exponent . value ) ;
jstrafe [ 0 ] * = mag ;
jstrafe [ 1 ] * = mag ;
2020-09-08 05:11:09 +00:00
2017-09-20 11:27:13 +00:00
mag = joydeadzone ( fabs ( jstrafe [ 2 ] ) , joy_movethreshold [ 2 ] . value ) ;
2020-09-08 05:11:09 +00:00
mag = pow ( mag , joy_exponent . value ) ;
2017-09-20 11:27:13 +00:00
jstrafe [ 2 ] * = mag ;
}
else
{
for ( i = 0 ; i < 3 ; i + + )
{
mag = joydeadzone ( fabs ( jlook [ i ] ) , joy_anglethreshold [ i ] . value ) ;
mag = pow ( mag , joy_exponent . value ) ;
jlook [ i ] * = mag ;
mag = joydeadzone ( fabs ( jstrafe [ i ] ) , joy_movethreshold [ i ] . value ) ;
mag = pow ( mag , joy_exponent . value ) ;
jstrafe [ i ] * = mag ;
}
}
if ( Key_Dest_Has ( ~ kdm_game ) )
{
VectorClear ( jlook ) ;
VectorClear ( jstrafe ) ;
}
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 10:56:18 +00:00
if ( in_speed . state [ pnum ] & 1 )
{
VectorScale ( jlook , 360 * cl_movespeedkey . value , jlook ) ;
VectorScale ( jstrafe , 360 * cl_movespeedkey . value , jstrafe ) ;
2017-09-20 11:27:13 +00:00
}
VectorScale ( jlook , 360 * frametime , jlook ) ;
2014-03-30 08:55:06 +00:00
if ( ! movements ) //if this is null, gamecode should still get inputs, just no camera looking or anything.
2017-09-20 11:27:13 +00:00
return ;
2014-03-30 08:55:06 +00:00
//angle changes
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 10:56:18 +00:00
cl . playerview [ pnum ] . viewanglechange [ PITCH ] + = joy_anglesens [ 0 ] . value * jlook [ 0 ] ;
2021-07-25 16:12:24 +00:00
cl . playerview [ pnum ] . viewanglechange [ YAW ] - = joy_anglesens [ 1 ] . value * jlook [ 1 ] ;
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 10:56:18 +00:00
cl . playerview [ pnum ] . viewanglechange [ ROLL ] + = joy_anglesens [ 2 ] . value * jlook [ 2 ] ;
2014-03-30 08:55:06 +00:00
if ( in_mlook . state [ pnum ] & 1 )
V_StopPitchDrift ( & cl . playerview [ pnum ] ) ;
2017-09-20 11:27:13 +00:00
//movement
2020-09-08 05:11:09 +00:00
mag = 1 ;
if ( ( in_speed . state [ pnum ] & 1 ) ^ cl_run . ival )
mag * = cl_movespeedkey . value ;
movements [ 0 ] + = joy_movesens [ 0 ] . value * mag * cl_forwardspeed . value * jstrafe [ 0 ] ;
movements [ 1 ] + = joy_movesens [ 1 ] . value * mag * cl_sidespeed . value * jstrafe [ 1 ] ;
movements [ 2 ] + = joy_movesens [ 2 ] . value * mag * cl_upspeed . value * jstrafe [ 2 ] ;
2017-09-20 11:27:13 +00:00
}
void IN_Move ( float * movements , int pnum , float frametime )
{
int i ;
for ( i = 0 ; i < MAXPOINTERS ; i + + )
IN_MoveMouse ( & ptr [ i ] , movements , pnum , frametime ) ;
for ( i = 0 ; i < MAXJOYSTICKS ; i + + )
IN_MoveJoystick ( & joy [ i ] , movements , pnum , frametime ) ;
}
void IN_JoystickAxisEvent ( unsigned int devid , int axis , float value )
{
2014-03-30 08:55:06 +00:00
struct eventlist_s * ev = in_newevent ( ) ;
if ( ! ev )
return ;
ev - > type = IEV_JOYAXIS ;
ev - > devid = devid ;
ev - > joy . axis = axis ;
ev - > joy . value = value ;
2017-09-20 11:27:13 +00:00
in_finishevent ( ) ;
}
2012-10-14 09:00:49 +00:00
2016-07-21 19:27:59 +00:00
void IN_KeyEvent ( unsigned int devid , int down , int keycode , int unicode )
2012-04-09 19:12:12 +00:00
{
struct eventlist_s * ev = in_newevent ( ) ;
2018-12-20 00:57:15 +00:00
if ( ! ev )
2012-04-09 19:12:12 +00:00
return ;
ev - > type = down ? IEV_KEYDOWN : IEV_KEYRELEASE ;
2012-12-15 00:25:54 +00:00
ev - > devid = devid ;
2012-04-09 19:12:12 +00:00
ev - > keyboard . scancode = keycode ;
ev - > keyboard . unicode = unicode ;
in_finishevent ( ) ;
}
2012-10-14 09:00:49 +00:00
/*
devid is the mouse device id . generally idependant from keyboards .
for multitouch , devid might be the touch identifier , which will persist until released .
x is horizontal , y is vertical .
z is height . . . generally its used as a mousewheel instead , but there are some ' 3 d ' mice out there , so its provided in this api .
2012-04-09 19:12:12 +00:00
*/
2016-07-21 19:27:59 +00:00
void IN_MouseMove ( unsigned int devid , int abs , float x , float y , float z , float size )
2012-04-09 19:12:12 +00:00
{
2018-06-02 08:55:57 +00:00
struct eventlist_s * ev ;
if ( ! abs & & ! x & & ! y & & ! z )
return ; //ignore non-movements
ev = in_newevent ( ) ;
2012-04-09 19:12:12 +00:00
if ( ! ev )
return ;
2012-10-14 09:00:49 +00:00
ev - > devid = devid ;
ev - > type = abs ? IEV_MOUSEABS : IEV_MOUSEDELTA ;
ev - > mouse . x = x ;
ev - > mouse . y = y ;
ev - > mouse . z = z ;
ev - > mouse . tsize = size ;
2012-04-09 19:12:12 +00:00
in_finishevent ( ) ;
}
2017-10-13 17:50:28 +00:00
void IN_Accelerometer ( unsigned int devid , float x , float y , float z )
{
struct eventlist_s * ev = in_newevent ( ) ;
if ( ! ev )
return ;
ev - > devid = devid ;
ev - > type = IEV_ACCELEROMETER ;
ev - > accel . x = x ;
ev - > accel . y = y ;
ev - > accel . z = z ;
in_finishevent ( ) ;
}
void IN_Gyroscope ( unsigned int devid , float pitch , float yaw , float roll )
{
struct eventlist_s * ev = in_newevent ( ) ;
if ( ! ev )
return ;
ev - > devid = devid ;
ev - > type = IEV_GYROSCOPE ;
ev - > gyro . pitch = pitch ;
ev - > gyro . yaw = yaw ;
ev - > gyro . roll = roll ;
in_finishevent ( ) ;
}
2021-04-14 05:21:04 +00:00
extern usercmd_t cl_pendingcmd [ MAX_SPLITS ] ;
qboolean IN_SetHandPosition ( const char * devname , vec3_t org , vec3_t ang , vec3_t vel , vec3_t avel )
{
int dtype ;
int seat ;
2021-05-09 13:02:49 +00:00
struct vrdevinfo_s * dev ;
2021-04-14 05:21:04 +00:00
if ( ! strncmp ( devname , " left " , 4 ) )
{
seat = atoi ( devname + 4 ) ;
dtype = VRDEV_LEFT ;
}
else if ( ! strncmp ( devname , " right " , 5 ) )
{
seat = atoi ( devname + 5 ) ;
dtype = VRDEV_RIGHT ;
}
else if ( ! strncmp ( devname , " head " , 4 ) )
{
seat = atoi ( devname + 4 ) ;
dtype = VRDEV_HEAD ;
}
else
return false ; //no idea what you're talking about.
if ( seat < 0 | | seat > = MAX_SPLITS )
return false ; //duuuude!
2021-05-09 13:02:49 +00:00
dev = & cl . playerview [ seat ] . vrdev [ dtype ] ;
2021-04-14 05:21:04 +00:00
if ( org )
2021-05-09 13:02:49 +00:00
VectorCopy ( org , dev - > origin ) ;
else
VectorClear ( dev - > origin ) ;
2021-04-14 05:21:04 +00:00
if ( ang )
2021-05-09 13:02:49 +00:00
{
dev - > angles [ 0 ] = ANGLE2SHORT ( ang [ 0 ] ) ,
dev - > angles [ 1 ] = ANGLE2SHORT ( ang [ 1 ] ) ,
dev - > angles [ 2 ] = ANGLE2SHORT ( ang [ 2 ] ) ;
}
else
VectorClear ( dev - > angles ) ;
2021-04-14 05:21:04 +00:00
if ( vel )
2021-05-09 13:02:49 +00:00
VectorCopy ( vel , dev - > velocity ) ;
else
VectorClear ( dev - > velocity ) ;
2021-04-14 05:21:04 +00:00
if ( avel )
2021-05-09 13:02:49 +00:00
dev - > avelocity [ 0 ] = ANGLE2SHORT ( avel [ 0 ] ) ,
dev - > avelocity [ 1 ] = ANGLE2SHORT ( avel [ 1 ] ) ,
dev - > avelocity [ 2 ] = ANGLE2SHORT ( avel [ 2 ] ) ;
else
VectorClear ( dev - > avelocity ) ;
dev - > status =
( org ? VRSTATUS_ORG : 0 ) |
( ang ? VRSTATUS_ANG : 0 ) |
( vel ? VRSTATUS_VEL : 0 ) |
( avel ? VRSTATUS_AVEL : 0 ) ;
2021-04-14 05:21:04 +00:00
return true ;
}