2004-08-23 00:15:46 +00:00
/*
Copyright ( C ) 1996 - 1997 Id Software , Inc .
This program is free software ; you can redistribute it and / or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation ; either version 2
of the License , or ( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
2005-06-14 04:52:10 +00:00
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE .
2004-08-23 00:15:46 +00:00
See the GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*/
// snd_dma.c -- main control for any streaming sound output devices
# include "quakedef.h"
2020-07-01 05:32:21 +00:00
# ifdef __GNUC__
# define fte_weakstruct __attribute__((weak))
# else
//msvc's uninitialised symbols are always weak, so this is fine.
# define fte_weakstruct
# endif
2016-07-12 00:40:13 +00:00
# ifdef CSQC_DAT
//for sounds following csqc ents
# include "pr_common.h"
extern world_t csqc_world ;
# endif
2019-02-20 17:21:10 +00:00
static void S_Play_f ( void ) ;
2012-02-27 12:23:15 +00:00
static void S_SoundList_f ( void ) ;
2017-05-23 07:03:07 +00:00
# ifdef HAVE_MIXER
2012-02-27 12:23:15 +00:00
static void S_Update_ ( soundcardinfo_t * sc ) ;
2017-05-23 07:03:07 +00:00
# endif
2004-08-23 00:15:46 +00:00
void S_StopAllSounds ( qboolean clear ) ;
2012-02-27 12:23:15 +00:00
static void S_StopAllSounds_f ( void ) ;
2004-08-23 00:15:46 +00:00
2012-02-27 12:23:15 +00:00
static void S_UpdateCard ( soundcardinfo_t * sc ) ;
static void S_ClearBuffer ( soundcardinfo_t * sc ) ;
2004-08-23 00:15:46 +00:00
// =======================================================================
// Internal sound data & structures
// =======================================================================
2005-06-14 04:52:10 +00:00
soundcardinfo_t * sndcardinfo ; //the master card.
2004-08-23 00:15:46 +00:00
int snd_blocked = 0 ;
static qboolean snd_ambient = 1 ;
qboolean snd_initialized = false ;
int snd_speed ;
2017-05-23 07:03:07 +00:00
float voicevolumemod = 1 ;
2004-08-23 00:15:46 +00:00
2021-04-14 05:21:04 +00:00
static struct listener_s
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
{
int entnum ;
vec3_t origin ;
vec3_t velocity ;
vec3_t forward ;
vec3_t right ;
vec3_t up ;
} listener [ MAX_SPLITS ] ;
2019-07-19 02:13:19 +00:00
cvar_t snd_nominaldistance = CVARAFD ( " s_nominaldistance " , " 1000 " , " snd_soundradius " , CVAR_CHEAT , " This cvar defines how far an attenuation=1 sound can be heard. " ) ;
2004-08-23 00:15:46 +00:00
2014-02-07 08:38:40 +00:00
# define MAX_SFX 8192
2004-08-23 00:15:46 +00:00
sfx_t * known_sfx ; // hunk allocated [MAX_SFX]
int num_sfx ;
sfx_t * ambient_sfx [ NUM_AMBIENTS ] ;
//int desired_speed = 44100;
int desired_bits = 16 ;
int sound_started = 0 ;
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
cvar_t mastervolume = CVARFD ( " mastervolume " , " 1 " , CVAR_ARCHIVE , " Additional multiplier for all other sounds. " ) ;
2014-03-30 10:43:05 +00:00
cvar_t bgmvolume = CVARAFD ( " musicvolume " , " 0.3 " , " bgmvolume " , CVAR_ARCHIVE ,
2011-06-07 23:54:58 +00:00
" Volume level for background music. " ) ;
2019-03-12 05:04:27 +00:00
cvar_t volume = CVARAFD ( " volume " , " 0.7 " , /*q3*/ " s_volume " , CVAR_ARCHIVE ,
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
" Volume level for game sounds (does not affect music, voice, or cinematics). " ) ;
2010-07-11 02:22:39 +00:00
2011-12-26 15:19:13 +00:00
cvar_t nosound = CVARFD ( " nosound " , " 0 " , CVAR_ARCHIVE ,
2013-06-23 02:17:02 +00:00
" Disable all sound from the engine. Cannot be overriden by configs or anything if set via the -nosound commandline argument. " ) ;
2020-06-12 23:29:58 +00:00
cvar_t snd_precache = CVARAF ( " s_precache " , " 1 " ,
2010-07-11 02:22:39 +00:00
" precache " , 0 ) ;
2020-10-26 06:30:35 +00:00
cvar_t snd_loadas8bit = CVARAFD ( " s_loadas8bit " , " 0 " ,
2011-12-26 15:19:13 +00:00
" loadas8bit " , CVAR_ARCHIVE ,
2020-04-26 01:32:02 +00:00
" Downsample sounds on load as lower quality 8-bit sound, to save memory. " ) ;
# ifdef FTE_TARGET_WEB
cvar_t snd_loadasstereo = CVARD ( " snd_loadasstereo " , " 1 " ,
" Force mono sounds to load as if stereo ones, to waste memory. Used to work around stupid browser bugs. " ) ;
# else
cvar_t snd_loadasstereo = CVARD ( " snd_loadasstereo " , " 0 " ,
" Force mono sounds to load as if stereo ones, to waste memory. Not normally useful. " ) ;
# endif
2016-07-12 00:40:13 +00:00
cvar_t ambient_level = CVARAFD ( " s_ambientlevel " , " 0.3 " ,
" ambient_level " , CVAR_ARCHIVE ,
" This controls the volume levels of automatic area-based sounds (like water or sky), and is quite annoying. If you're playing deathmatch you'll definitely want this OFF. " ) ;
2010-07-11 02:22:39 +00:00
cvar_t ambient_fade = CVARAF ( " s_ambientfade " , " 100 " ,
2015-06-15 20:11:27 +00:00
" ambient_fade " , CVAR_ARCHIVE ) ;
2010-07-11 02:22:39 +00:00
cvar_t snd_noextraupdate = CVARAF ( " s_noextraupdate " , " 0 " ,
" snd_noextraupdate " , 0 ) ;
cvar_t snd_show = CVARAF ( " s_show " , " 0 " ,
" snd_show " , 0 ) ;
2017-05-19 03:32:02 +00:00
# ifdef __DJGPP__
# define DEFAULT_SND_KHZ "11"
# else
//fixme: are android devices more likely to use 44.1khz?
# define DEFAULT_SND_KHZ "48" //most modern systems should go with 48khz audio (dvd quality). various hardware codecs support nothing else.
# endif
cvar_t snd_khz = CVARAFD ( " s_khz " , DEFAULT_SND_KHZ ,
2013-06-23 02:17:02 +00:00
" snd_khz " , CVAR_ARCHIVE , " Sound speed, in kilohertz. Common values are 11, 22, 44, 48. Values above 1000 are explicitly in hertz. " ) ;
2015-04-14 23:12:17 +00:00
cvar_t snd_inactive = CVARAFD ( " s_inactive " , " 1 " ,
2015-06-15 20:11:27 +00:00
" snd_inactive " , CVAR_ARCHIVE ,
2018-12-28 00:04:36 +00:00
" Play sound while application is inactive (ie: tabbed out). Needs a snd_restart if changed. "
2011-06-07 23:54:58 +00:00
) ; //set if you want sound even when tabbed out.
2013-08-27 13:18:09 +00:00
cvar_t _snd_mixahead = CVARAFD ( " s_mixahead " , " 0.1 " ,
2016-07-12 00:40:13 +00:00
" _snd_mixahead " , CVAR_ARCHIVE , " Specifies how many seconds to prebuffer audio. Lower values give less latency, but might result in crackling. Different hardware/drivers have different tolerances, and this setting may be ignored completely where drivers are expected to provide their own tolerances. " ) ;
2010-07-11 02:22:39 +00:00
cvar_t snd_leftisright = CVARAF ( " s_swapstereo " , " 0 " ,
" snd_leftisright " , CVAR_ARCHIVE ) ;
cvar_t snd_eax = CVARAF ( " s_eax " , " 0 " ,
" snd_eax " , 0 ) ;
2012-03-19 06:30:41 +00:00
cvar_t snd_speakers = CVARAFD ( " s_numspeakers " , " 2 " ,
2018-12-11 00:20:59 +00:00
" snd_numspeakers " , CVAR_ARCHIVE , " Number of hardware audio channels to use. " FULLENGINENAME " supports up to 6. " ) ;
2010-07-11 02:22:39 +00:00
cvar_t snd_buffersize = CVARAF ( " s_buffersize " , " 0 " ,
" snd_buffersize " , 0 ) ;
cvar_t snd_samplebits = CVARAF ( " s_bits " , " 16 " ,
" snd_samplebits " , CVAR_ARCHIVE ) ;
2011-06-07 23:54:58 +00:00
cvar_t snd_playersoundvolume = CVARAFD ( " s_localvolume " , " 1 " ,
2015-06-15 20:11:27 +00:00
" snd_localvolume " , CVAR_ARCHIVE ,
2011-06-07 23:54:58 +00:00
" Sound level for sounds local or originating from the player such as firing and pain sounds. " ) ; //sugested by crunch
2016-07-12 00:40:13 +00:00
cvar_t snd_doppler = CVARAFD ( " s_doppler " , " 0 " ,
" snd_doppler " , CVAR_ARCHIVE ,
" Enables doppler, with a multiplier for the scale. " ) ;
cvar_t snd_doppler_min = CVARAFD ( " s_doppler_min " , " 0.5 " ,
" snd_doppler_min " , CVAR_ARCHIVE ,
" Slowest allowed doppler scale. " ) ;
cvar_t snd_doppler_max = CVARAFD ( " s_doppler_max " , " 2 " ,
2016-07-26 11:47:59 +00:00
" snd_doppler_max " , CVAR_ARCHIVE ,
2016-07-12 00:40:13 +00:00
" Highest allowed doppler scale, to avoid things getting too weird. " ) ;
2012-02-27 12:23:15 +00:00
cvar_t snd_playbackrate = CVARFD ( " snd_playbackrate " , " 1 " , CVAR_CHEAT , " Debugging cvar that changes the playback rate of all new sounds. " ) ;
2019-10-05 06:36:45 +00:00
cvar_t snd_ignoregamespeed = CVARFD ( " snd_ignoregamespeed " , " 0 " , 0 , " When set, allows sounds to desynchronise with game time or demo speeds. " ) ;
2012-02-27 12:23:15 +00:00
2020-03-07 09:00:40 +00:00
cvar_t snd_ignorecueloops = CVARD ( " snd_ignorecueloops " , " 0 " , " Ignores cue commands in wav files, for q3 compat. " ) ;
2010-07-11 02:22:39 +00:00
cvar_t snd_linearresample = CVARAF ( " s_linearresample " , " 1 " ,
" snd_linearresample " , 0 ) ;
cvar_t snd_linearresample_stream = CVARAF ( " s_linearresample_stream " , " 0 " ,
" snd_linearresample_stream " , 0 ) ;
2013-04-07 08:59:05 +00:00
cvar_t snd_mixerthread = CVARAD ( " s_mixerthread " , " 1 " ,
" snd_mixerthread " , " When enabled sound mixing will be run on a separate thread. Currently supported only by directsound. Other drivers may unconditionally thread audio. Set to 0 only if you have issues. " ) ;
2015-05-14 03:06:58 +00:00
cvar_t snd_device = CVARAFD ( " s_device " , " " ,
2015-06-15 20:11:27 +00:00
" snd_device " , CVAR_ARCHIVE , " This is the sound device(s) to use, in the form of driver:device. \n If desired, multiple devices can be listed in space-seperated (quoted) tokens. _s_device_opts contains any enumerated options. \n In all seriousness, use the menu to set this if you wish to keep your hair. " ) ;
2021-10-31 18:20:28 +00:00
cvar_t snd_device_opts = CVARFD ( " _s_device_opts " , " " , CVAR_NOSET | CVAR_NOSAVE , " The possible audio output devices, in \" value \" \" description \" pairs, for gamecode to read. " ) ;
2005-06-14 04:52:10 +00:00
2010-11-15 03:37:29 +00:00
# ifdef VOICECHAT
2015-04-21 04:12:00 +00:00
static void QDECL S_Voip_Play_Callback ( cvar_t * var , char * oldval ) ;
2013-09-06 22:57:44 +00:00
cvar_t snd_voip_capturedevice = CVARF ( " cl_voip_capturedevice " , " " , CVAR_ARCHIVE ) ;
2021-10-31 18:20:28 +00:00
cvar_t snd_voip_capturedevice_opts = CVARFD ( " _cl_voip_capturedevice_opts " , " " , CVAR_NOSET | CVAR_NOSAVE , " The possible audio capture devices, in \" value \" \" description \" pairs, for gamecode to read. " ) ;
2013-09-06 22:57:44 +00:00
int voipbutton ; //+voip, no longer part of cl_voip_send to avoid it getting saved
2021-08-04 21:18:04 +00:00
cvar_t snd_voip_send = CVARFD ( " cl_voip_send " , " 0 " , CVAR_ARCHIVE | CVAR_NOTFROMSERVER , " Sends voice-over-ip data to the server whenever it is set. \n 0: only send voice if +voip is pressed. \n 1: voice activation. \n 2: constantly send. \n +4: Do not send to game, only to rtp sessions. " ) ;
2013-09-06 22:57:44 +00:00
cvar_t snd_voip_test = CVARD ( " cl_voip_test " , " 0 " , " If 1, enables you to hear your own voice directly, bypassing the server and thus without networking latency, but is fine for checking audio levels. Note that sv_voip_echo can be set if you want to include latency and packetloss considerations, but setting that cvar requires server admin access and is thus much harder to use. " ) ;
2015-06-15 20:11:27 +00:00
cvar_t snd_voip_vad_threshhold = CVARFD ( " cl_voip_vad_threshhold " , " 15 " , CVAR_ARCHIVE , " This is the threshhold for voice-activation-detection when sending voip data " ) ;
2013-09-06 22:57:44 +00:00
cvar_t snd_voip_vad_delay = CVARD ( " cl_voip_vad_delay " , " 0.3 " , " Keeps sending voice data for this many seconds after voice activation would normally stop " ) ;
2018-12-28 00:04:36 +00:00
cvar_t snd_voip_capturingvol = CVARAFD ( " cl_voip_capturingvol " , " 0.5 " , NULL , CVAR_ARCHIVE , " Volume multiplier applied while capturing, to avoid your audio from being heard by others. Does not affect game volume when others speak (minimum of cl_voip_capturingvol and cl_voip_ducking is used). " ) ;
2013-09-06 22:57:44 +00:00
cvar_t snd_voip_showmeter = CVARAFD ( " cl_voip_showmeter " , " 1 " , NULL , CVAR_ARCHIVE , " Shows your speech volume above the standard hud. 0=hide, 1=show when transmitting, 2=ignore voice-activation disable " ) ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
cvar_t snd_voip_play = CVARAFCD ( " cl_voip_play " , " 1 " , NULL , CVAR_ARCHIVE , S_Voip_Play_Callback , " Enables voip playback. Value is a volume scaler. " ) ;
2013-09-06 22:57:44 +00:00
cvar_t snd_voip_ducking = CVARAFD ( " cl_voip_ducking " , " 0.5 " , NULL , CVAR_ARCHIVE , " Scales game audio by this much when someone is talking to you. Does not affect your speaker volume when you speak (minimum of cl_voip_capturingvol and cl_voip_ducking is used). " ) ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
cvar_t snd_voip_micamp = CVARAFD ( " cl_voip_micamp " , " 2 " , NULL , CVAR_ARCHIVE , " Amplifies your microphone when using voip. " ) ;
2017-11-14 14:37:04 +00:00
cvar_t snd_voip_codec = CVARAFD ( " cl_voip_codec " , " " , NULL , CVAR_ARCHIVE , " 0: speex(@11khz). 1: raw. 2: opus. 3: speex(@8khz). 4: speex(@16). 5:speex(@32). 6: pcma. 7: pcmu. " ) ;
2019-04-17 00:50:14 +00:00
# ifdef HAVE_SPEEX
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
cvar_t snd_voip_noisefilter = CVARAFD ( " cl_voip_noisefilter " , " 1 " , NULL , CVAR_ARCHIVE , " Enable the use of the noise cancelation filter. " ) ;
cvar_t snd_voip_autogain = CVARAFD ( " cl_voip_autogain " , " 0 " , NULL , CVAR_ARCHIVE , " Attempts to normalize your voice levels to a standard level. Useful for lazy people, but interferes with voice activation levels. " ) ;
2019-04-17 00:50:14 +00:00
# endif
2018-01-22 19:18:04 +00:00
cvar_t snd_voip_bitrate = CVARAFD ( " cl_voip_bitrate " , " 3000 " , NULL , CVAR_ARCHIVE , " For codecs with non-specific bitrates, this specifies the target bitrate to use. " ) ;
2010-11-15 03:37:29 +00:00
# endif
2006-05-09 07:26:14 +00:00
extern vfsfile_t * rawwritefile ;
2012-02-27 12:23:15 +00:00
# ifdef MULTITHREAD
void * mixermutex ;
void S_LockMixer ( void )
{
Sys_LockMutex ( mixermutex ) ;
}
void S_UnlockMixer ( void )
{
Sys_UnlockMutex ( mixermutex ) ;
}
# else
void S_LockMixer ( void )
{
}
void S_UnlockMixer ( void )
{
}
# endif
2004-08-23 00:15:46 +00:00
void S_AmbientOff ( void )
{
snd_ambient = false ;
}
void S_AmbientOn ( void )
{
snd_ambient = true ;
}
2009-04-01 22:03:56 +00:00
qboolean S_HaveOutput ( void )
{
return sound_started & & sndcardinfo ;
}
2004-08-23 00:15:46 +00:00
void S_SoundInfo_f ( void )
{
2013-04-13 08:15:18 +00:00
int i , j ;
int active , known ;
2004-08-23 00:15:46 +00:00
soundcardinfo_t * sc ;
if ( ! sound_started )
{
Con_Printf ( " sound system not started \n " ) ;
return ;
}
if ( ! sndcardinfo )
{
2005-09-26 08:07:26 +00:00
Con_Printf ( " No sound cards \n " ) ;
2004-08-23 00:15:46 +00:00
return ;
}
for ( sc = sndcardinfo ; sc ; sc = sc - > next )
{
2013-04-13 08:15:18 +00:00
Con_Printf ( " Audio Device: %s \n " , sc - > name ) ;
2017-09-20 11:27:13 +00:00
Con_Printf ( " %d channels, %gkhz, %d bit audio%s \n " , sc - > sn . numchannels , sc - > sn . speed / 1000.0 , sc - > sn . samplebytes * 8 , sc - > selfpainting ? " , threaded " : " " ) ;
2013-04-13 08:15:18 +00:00
Con_Printf ( " %d samples in buffer \n " , sc - > sn . samples ) ;
for ( i = 0 , active = 0 , known = 0 ; i < sc - > total_chans ; i + + )
{
if ( sc - > channel [ i ] . sfx )
{
known + + ;
for ( j = 0 ; j < MAXSOUNDCHANNELS ; j + + )
{
if ( sc - > channel [ i ] . vol [ j ] )
{
active + + ;
break ;
}
}
if ( j < MAXSOUNDCHANNELS )
Con_Printf ( " %s (%i %i, %g %g %g, active) \n " , sc - > channel [ i ] . sfx - > name , sc - > channel [ i ] . entnum , sc - > channel [ i ] . entchannel , sc - > channel [ i ] . origin [ 0 ] , sc - > channel [ i ] . origin [ 1 ] , sc - > channel [ i ] . origin [ 2 ] ) ;
else
Con_DPrintf ( " %s (%i %i, %g %g %g, inactive) \n " , sc - > channel [ i ] . sfx - > name , sc - > channel [ i ] . entnum , sc - > channel [ i ] . entchannel , sc - > channel [ i ] . origin [ 0 ] , sc - > channel [ i ] . origin [ 1 ] , sc - > channel [ i ] . origin [ 2 ] ) ;
}
}
2017-01-15 13:13:09 +00:00
Con_Printf ( " %d/%d/% " PRIiSIZE " /% " PRIiSIZE " active/known/highest/max \n " , active , known , sc - > total_chans , sc - > max_chans ) ;
2013-04-13 08:15:18 +00:00
for ( i = 0 ; i < sc - > sn . numchannels ; i + + )
{
Con_Printf ( " chan %i: fwd:%-4g rt:%-4g up:%-4g dist:%-4g \n " , i , sc - > speakerdir [ i ] [ 0 ] , sc - > speakerdir [ i ] [ 1 ] , sc - > speakerdir [ i ] [ 2 ] , sc - > dist [ i ] ) ;
}
2004-08-23 00:15:46 +00:00
}
}
2010-11-15 02:40:31 +00:00
# ifdef VOICECHAT
2017-10-13 17:50:28 +00:00
# ifdef SPEEX_STATIC
2018-03-24 04:02:09 +00:00
# include <speex/speex.h>
# include <speex/speex_preprocess.h>
2017-10-13 17:50:28 +00:00
# else
typedef struct { int stuff [ 15 ] ; } SpeexBits ;
typedef struct SpeexMode SpeexMode ;
typedef struct SpeexPreprocessState SpeexPreprocessState ;
typedef qint16_t spx_int16_t ;
# define SPEEX_MODEID_NB 0
# define SPEEX_MODEID_WB 1
# define SPEEX_MODEID_UWB 2
# define SPEEX_GET_FRAME_SIZE 3
# define SPEEX_SET_SAMPLING_RATE 24
# define SPEEX_GET_SAMPLING_RATE 25
# define SPEEX_PREPROCESS_SET_DENOISE 0
# define SPEEX_PREPROCESS_SET_AGC 2
# define SPEEX_PREPROCESS_SET_AGC_MAX_GAIN 30
# endif
2013-05-31 01:16:07 +00:00
enum
{
2013-06-29 16:01:07 +00:00
VOIP_SPEEX_OLD = 0 , //original supported codec (with needless padding and at the wrong rate to keep quake implementations easy)
2017-01-17 19:04:09 +00:00
VOIP_RAW16 = 1 , //support is not recommended.
2013-06-29 16:01:07 +00:00
VOIP_OPUS = 2 , //supposed to be better than speex.
VOIP_SPEEX_NARROW = 3 , //narrowband speex. packed data.
VOIP_SPEEX_WIDE = 4 , //wideband speex. packed data.
2013-08-21 07:14:39 +00:00
VOIP_SPEEX_ULTRAWIDE = 5 , //wideband speex. packed data.
2017-06-21 01:24:25 +00:00
VOIP_PCMA = 6 , //G711 is kinda shit, encoding audio at 8khz with funny truncation for 13bit to 8bit
VOIP_PCMU = 7 , //ulaw version of g711 (instead of alaw)
2013-05-31 01:16:07 +00:00
VOIP_INVALID = 16 //not currently generating audio.
} ;
2019-04-16 22:40:05 +00:00
# if defined(HAVE_LEGACY) && defined(HAVE_OPUS) && defined(HAVE_SPEEX)
# define VOIP_DEFAULT_CODEC ((cls.protocol==CP_QUAKEWORLD && !(cls.fteprotocolextensions2&PEXT2_REPLACEMENTDELTAS))?VOIP_SPEEX_OLD:VOIP_OPUS) //opus is preferred, but ezquake is still common and only supports my first attempt at voice compression so favour that for mvdsv servers.
# elif defined(HAVE_OPUS)
# define VOIP_DEFAULT_CODEC VOIP_OPUS
# elif defined(HAVE_SPEEX)
# define VOIP_DEFAULT_CODEC VOIP_SPEEX_OLD
2018-12-28 00:04:36 +00:00
# else
2019-04-16 22:40:05 +00:00
# define VOIP_DEFAULT_CODEC VOIP_PCMA
2018-12-28 00:04:36 +00:00
# endif
2019-04-16 22:40:05 +00:00
2010-11-16 02:03:47 +00:00
static struct
2005-08-03 23:14:59 +00:00
{
2019-04-16 22:40:05 +00:00
# ifdef HAVE_SPEEX
2013-05-31 01:16:07 +00:00
struct
{
qboolean inited ;
qboolean loaded ;
dllhandle_t * speexlib ;
SpeexBits encbits ;
SpeexBits decbits [ MAX_CLIENTS ] ;
2010-11-15 02:40:31 +00:00
2013-06-29 16:01:07 +00:00
const SpeexMode * modenb ;
const SpeexMode * modewb ;
2013-08-21 07:14:39 +00:00
const SpeexMode * modeuwb ;
2013-05-31 01:16:07 +00:00
} speex ;
struct
{
qboolean inited ;
qboolean loaded ;
dllhandle_t * speexdsplib ;
SpeexPreprocessState * preproc ; //filter out noise
int curframesize ;
int cursamplerate ;
} speexdsp ;
2019-04-16 22:40:05 +00:00
# endif
2013-05-31 01:16:07 +00:00
2019-04-16 22:40:05 +00:00
# ifdef HAVE_OPUS
2013-05-31 01:16:07 +00:00
struct
{
qboolean inited ;
qboolean loaded ;
dllhandle_t * opuslib ;
} opus ;
2019-04-16 22:40:05 +00:00
# endif
2013-05-31 01:16:07 +00:00
unsigned char enccodec ;
2010-11-15 02:40:31 +00:00
void * encoder ;
2013-05-31 01:16:07 +00:00
unsigned int encframesize ;
unsigned int encsamplerate ;
2010-11-15 02:40:31 +00:00
void * decoder [ MAX_CLIENTS ] ;
2018-11-22 03:02:36 +00:00
float declevel [ MAX_CLIENTS ] ;
2013-05-31 01:16:07 +00:00
unsigned char deccodec [ MAX_CLIENTS ] ;
2010-11-20 22:01:16 +00:00
unsigned char decseq [ MAX_CLIENTS ] ; /*sender's sequence, to detect+cover minor packetloss*/
unsigned char decgen [ MAX_CLIENTS ] ; /*last generation. if it changes, we flush speex to reset packet loss*/
2013-05-31 01:16:07 +00:00
unsigned int decsamplerate [ MAX_CLIENTS ] ;
unsigned int decframesize [ MAX_CLIENTS ] ;
2017-01-17 19:04:09 +00:00
float lastspoke [ MAX_CLIENTS ] ; /*time when they're no longer considered talking. if future, they're talking (timeout avoids flickering, and harder to troll with fake-tourettes when noone is looking)*/
2013-05-31 01:16:07 +00:00
float lastspoke_any ;
2010-11-20 22:01:16 +00:00
unsigned char capturebuf [ 32768 ] ; /*pending data*/
unsigned int capturepos ; /*amount of pending data*/
unsigned int encsequence ; /*the outgoing sequence count*/
2013-06-29 16:01:07 +00:00
unsigned int enctimestamp ; /*for rtp streaming*/
2010-11-20 22:01:16 +00:00
unsigned int generation ; /*incremented whenever capture is restarted*/
qboolean wantsend ; /*set if we're capturing data to send*/
float voiplevel ; /*your own voice level*/
unsigned int dumps ; /*trigger a new generation thing after a bit*/
unsigned int keeps ; /*for vad_delay*/
2016-01-18 05:22:07 +00:00
int curbitrate ;
2010-11-20 22:01:16 +00:00
2013-05-31 01:16:07 +00:00
snd_capture_driver_t * cdriver ; /*capture driver's functions*/
void * cdriverctx ; /*capture driver context*/
} s_voip ;
2019-04-16 22:40:05 +00:00
# ifdef HAVE_OPUS
2013-05-31 01:16:07 +00:00
# define OPUS_APPLICATION_VOIP 2048
2016-01-18 05:22:07 +00:00
# define OPUS_SET_BITRATE_REQUEST 4002
2013-05-31 01:16:07 +00:00
# define OPUS_RESET_STATE 4028
# ifdef OPUS_STATIC
# include "opus.h"
# define qopus_encoder_create opus_encoder_create
# define qopus_encoder_destroy opus_encoder_destroy
# define qopus_encoder_ctl opus_encoder_ctl
# define qopus_encode opus_encode
# define qopus_decoder_create opus_decoder_create
# define qopus_decoder_destroy opus_decoder_destroy
# define qopus_decoder_ctl opus_decoder_ctl
# define qopus_decode opus_decode
# else
# define opus_int32 int
# define opus_int16 short
# define OpusEncoder void
# define OpusDecoder void
static OpusEncoder * ( VARGS * qopus_encoder_create ) ( opus_int32 Fs , int channels , int application , int * error ) ;
static void ( VARGS * qopus_encoder_destroy ) ( OpusEncoder * st ) ;
static int ( VARGS * qopus_encoder_ctl ) ( OpusEncoder * st , int request , . . . ) ;
static opus_int32 ( VARGS * qopus_encode ) ( OpusEncoder * st , const opus_int16 * pcm , int frame_size , unsigned char * data , opus_int32 max_data_bytes ) ;
static OpusDecoder * ( VARGS * qopus_decoder_create ) ( opus_int32 Fs , int channels , int * error ) ;
static void ( VARGS * qopus_decoder_destroy ) ( OpusDecoder * st ) ;
static int ( VARGS * qopus_decoder_ctl ) ( OpusDecoder * st , int request , . . . ) ;
static int ( VARGS * qopus_decode ) ( OpusDecoder * st , const unsigned char * data , opus_int32 len , opus_int16 * pcm , int frame_size , int decode_fec ) ;
static dllfunction_t qopusfuncs [ ] =
{
{ ( void * ) & qopus_encoder_create , " opus_encoder_create " } ,
{ ( void * ) & qopus_encoder_destroy , " opus_encoder_destroy " } ,
{ ( void * ) & qopus_encoder_ctl , " opus_encoder_ctl " } ,
{ ( void * ) & qopus_encode , " opus_encode " } ,
{ ( void * ) & qopus_decoder_create , " opus_decoder_create " } ,
{ ( void * ) & qopus_decoder_destroy , " opus_decoder_destroy " } ,
{ ( void * ) & qopus_decoder_ctl , " opus_decoder_ctl " } ,
{ ( void * ) & qopus_decode , " opus_decode " } ,
{ NULL }
} ;
# endif
2019-04-16 22:40:05 +00:00
static qboolean S_Opus_Init ( void )
{
# ifndef OPUS_STATIC
# ifdef _WIN32
char * modulename = " libopus-0 " ARCH_DL_POSTFIX ;
# else
char * modulename = " libopus " ARCH_DL_POSTFIX " .0 " ;
# endif
if ( s_voip . opus . inited )
return s_voip . opus . loaded ;
s_voip . opus . inited = true ;
s_voip . opus . opuslib = Sys_LoadLibrary ( modulename , qopusfuncs ) ;
if ( ! s_voip . opus . opuslib )
{
Con_Printf ( " %s not found. Voice chat is not available. \n " , modulename ) ;
return false ;
}
# endif
s_voip . opus . loaded = true ;
return s_voip . opus . loaded ;
}
# endif
2010-11-15 02:40:31 +00:00
2019-04-16 22:40:05 +00:00
# ifdef HAVE_SPEEX
Android: fat presses, vibrator, onscreen keyboard, keep-screen-on, console scaling, touch-based console scrolling, additional bindables.
Some memory leaks fixed.
latency with the nq protocol over loopback is much reduced.
Terrain: now mostly a property of a (q1 for now) bsp map, file format changed, glsl now built in, terrain editor builtin improved/changed, holes supported.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4067 fc73d0e0-1445-4013-8a0c-d673dee63da5
2012-07-14 16:25:18 +00:00
# ifdef SPEEX_STATIC
# define qspeex_lib_get_mode speex_lib_get_mode
# define qspeex_bits_init speex_bits_init
# define qspeex_bits_reset speex_bits_reset
# define qspeex_bits_write speex_bits_write
# define qspeex_preprocess_state_init speex_preprocess_state_init
2013-05-31 01:28:59 +00:00
# define qspeex_preprocess_state_destroy speex_preprocess_state_destroy
Android: fat presses, vibrator, onscreen keyboard, keep-screen-on, console scaling, touch-based console scrolling, additional bindables.
Some memory leaks fixed.
latency with the nq protocol over loopback is much reduced.
Terrain: now mostly a property of a (q1 for now) bsp map, file format changed, glsl now built in, terrain editor builtin improved/changed, holes supported.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4067 fc73d0e0-1445-4013-8a0c-d673dee63da5
2012-07-14 16:25:18 +00:00
# define qspeex_preprocess_ctl speex_preprocess_ctl
# define qspeex_preprocess_run speex_preprocess_run
# define qspeex_encoder_init speex_encoder_init
2013-05-31 01:28:59 +00:00
# define qspeex_encoder_destroy speex_encoder_destroy
Android: fat presses, vibrator, onscreen keyboard, keep-screen-on, console scaling, touch-based console scrolling, additional bindables.
Some memory leaks fixed.
latency with the nq protocol over loopback is much reduced.
Terrain: now mostly a property of a (q1 for now) bsp map, file format changed, glsl now built in, terrain editor builtin improved/changed, holes supported.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4067 fc73d0e0-1445-4013-8a0c-d673dee63da5
2012-07-14 16:25:18 +00:00
# define qspeex_encoder_ctl speex_encoder_ctl
# define qspeex_encode_int speex_encode_int
# define qspeex_decoder_init speex_decoder_init
2013-05-31 01:28:59 +00:00
# define qspeex_decoder_destroy speex_decoder_destroy
Android: fat presses, vibrator, onscreen keyboard, keep-screen-on, console scaling, touch-based console scrolling, additional bindables.
Some memory leaks fixed.
latency with the nq protocol over loopback is much reduced.
Terrain: now mostly a property of a (q1 for now) bsp map, file format changed, glsl now built in, terrain editor builtin improved/changed, holes supported.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4067 fc73d0e0-1445-4013-8a0c-d673dee63da5
2012-07-14 16:25:18 +00:00
# define qspeex_decode_int speex_decode_int
# define qspeex_bits_read_from speex_bits_read_from
# else
2010-11-16 02:03:47 +00:00
static const SpeexMode * ( VARGS * qspeex_lib_get_mode ) ( int mode ) ;
static void ( VARGS * qspeex_bits_init ) ( SpeexBits * bits ) ;
static void ( VARGS * qspeex_bits_reset ) ( SpeexBits * bits ) ;
static int ( VARGS * qspeex_bits_write ) ( SpeexBits * bits , char * bytes , int max_len ) ;
2010-11-15 02:40:31 +00:00
2010-11-16 02:03:47 +00:00
static SpeexPreprocessState * ( VARGS * qspeex_preprocess_state_init ) ( int frame_size , int sampling_rate ) ;
2013-05-31 01:16:07 +00:00
static void ( VARGS * qspeex_preprocess_state_destroy ) ( SpeexPreprocessState * st ) ;
2010-11-16 02:03:47 +00:00
static int ( VARGS * qspeex_preprocess_ctl ) ( SpeexPreprocessState * st , int request , void * ptr ) ;
static int ( VARGS * qspeex_preprocess_run ) ( SpeexPreprocessState * st , spx_int16_t * x ) ;
2010-11-15 02:40:31 +00:00
2010-11-16 02:03:47 +00:00
static void * ( VARGS * qspeex_encoder_init ) ( const SpeexMode * mode ) ;
static int ( VARGS * qspeex_encoder_ctl ) ( void * state , int request , void * ptr ) ;
static int ( VARGS * qspeex_encode_int ) ( void * state , spx_int16_t * in , SpeexBits * bits ) ;
2010-11-15 02:40:31 +00:00
2010-11-16 02:03:47 +00:00
static void * ( VARGS * qspeex_decoder_init ) ( const SpeexMode * mode ) ;
2013-05-31 01:16:07 +00:00
static void ( VARGS * qspeex_decoder_destroy ) ( void * state ) ;
2010-11-16 02:03:47 +00:00
static int ( VARGS * qspeex_decode_int ) ( void * state , SpeexBits * bits , spx_int16_t * out ) ;
static void ( VARGS * qspeex_bits_read_from ) ( SpeexBits * bits , char * bytes , int len ) ;
2010-11-15 02:40:31 +00:00
2010-11-16 02:03:47 +00:00
static dllfunction_t qspeexfuncs [ ] =
2010-11-15 02:40:31 +00:00
{
{ ( void * ) & qspeex_lib_get_mode , " speex_lib_get_mode " } ,
{ ( void * ) & qspeex_bits_init , " speex_bits_init " } ,
{ ( void * ) & qspeex_bits_reset , " speex_bits_reset " } ,
{ ( void * ) & qspeex_bits_write , " speex_bits_write " } ,
{ ( void * ) & qspeex_encoder_init , " speex_encoder_init " } ,
{ ( void * ) & qspeex_encoder_ctl , " speex_encoder_ctl " } ,
{ ( void * ) & qspeex_encode_int , " speex_encode_int " } ,
{ ( void * ) & qspeex_decoder_init , " speex_decoder_init " } ,
2013-05-31 01:16:07 +00:00
{ ( void * ) & qspeex_decoder_destroy , " speex_decoder_destroy " } ,
2010-11-15 02:40:31 +00:00
{ ( void * ) & qspeex_decode_int , " speex_decode_int " } ,
{ ( void * ) & qspeex_bits_read_from , " speex_bits_read_from " } ,
{ NULL }
} ;
2010-11-16 02:03:47 +00:00
static dllfunction_t qspeexdspfuncs [ ] =
2010-11-15 02:40:31 +00:00
{
{ ( void * ) & qspeex_preprocess_state_init , " speex_preprocess_state_init " } ,
2013-05-31 01:16:07 +00:00
{ ( void * ) & qspeex_preprocess_state_destroy , " speex_preprocess_state_destroy " } ,
2010-11-15 02:40:31 +00:00
{ ( void * ) & qspeex_preprocess_ctl , " speex_preprocess_ctl " } ,
{ ( void * ) & qspeex_preprocess_run , " speex_preprocess_run " } ,
{ NULL }
} ;
Android: fat presses, vibrator, onscreen keyboard, keep-screen-on, console scaling, touch-based console scrolling, additional bindables.
Some memory leaks fixed.
latency with the nq protocol over loopback is much reduced.
Terrain: now mostly a property of a (q1 for now) bsp map, file format changed, glsl now built in, terrain editor builtin improved/changed, holes supported.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4067 fc73d0e0-1445-4013-8a0c-d673dee63da5
2012-07-14 16:25:18 +00:00
# endif
2010-11-15 02:40:31 +00:00
2013-05-31 01:16:07 +00:00
static qboolean S_SpeexDSP_Init ( void )
2010-11-15 02:40:31 +00:00
{
Android: fat presses, vibrator, onscreen keyboard, keep-screen-on, console scaling, touch-based console scrolling, additional bindables.
Some memory leaks fixed.
latency with the nq protocol over loopback is much reduced.
Terrain: now mostly a property of a (q1 for now) bsp map, file format changed, glsl now built in, terrain editor builtin improved/changed, holes supported.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4067 fc73d0e0-1445-4013-8a0c-d673dee63da5
2012-07-14 16:25:18 +00:00
# ifndef SPEEX_STATIC
2013-05-31 01:16:07 +00:00
if ( s_voip . speexdsp . inited )
return s_voip . speexdsp . loaded ;
s_voip . speexdsp . inited = true ;
2010-11-15 02:40:31 +00:00
2019-04-16 22:40:05 +00:00
2013-05-31 01:16:07 +00:00
s_voip . speexdsp . speexdsplib = Sys_LoadLibrary ( " libspeexdsp " , qspeexdspfuncs ) ;
if ( ! s_voip . speexdsp . speexdsplib )
2010-11-15 02:40:31 +00:00
{
2013-05-31 01:16:07 +00:00
Con_Printf ( " libspeexdsp not found. Your mic may be noisy. \n " ) ;
2010-11-15 02:40:31 +00:00
return false ;
}
2013-05-31 01:16:07 +00:00
# endif
s_voip . speexdsp . loaded = true ;
return s_voip . speexdsp . loaded ;
}
static qboolean S_Speex_Init ( void )
{
# ifndef SPEEX_STATIC
if ( s_voip . speex . inited )
return s_voip . speex . loaded ;
s_voip . speex . inited = true ;
2010-11-15 02:40:31 +00:00
2013-05-31 01:16:07 +00:00
s_voip . speex . speexlib = Sys_LoadLibrary ( " libspeex " , qspeexfuncs ) ;
if ( ! s_voip . speex . speexlib )
2010-11-15 02:40:31 +00:00
{
2013-05-31 01:16:07 +00:00
Con_Printf ( " libspeex not found. Voice chat is not available. \n " ) ;
2010-11-15 02:40:31 +00:00
return false ;
}
Android: fat presses, vibrator, onscreen keyboard, keep-screen-on, console scaling, touch-based console scrolling, additional bindables.
Some memory leaks fixed.
latency with the nq protocol over loopback is much reduced.
Terrain: now mostly a property of a (q1 for now) bsp map, file format changed, glsl now built in, terrain editor builtin improved/changed, holes supported.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4067 fc73d0e0-1445-4013-8a0c-d673dee63da5
2012-07-14 16:25:18 +00:00
# endif
2010-11-15 02:40:31 +00:00
2013-06-29 16:01:07 +00:00
s_voip . speex . modenb = qspeex_lib_get_mode ( SPEEX_MODEID_NB ) ;
s_voip . speex . modewb = qspeex_lib_get_mode ( SPEEX_MODEID_WB ) ;
2013-08-21 07:14:39 +00:00
s_voip . speex . modeuwb = qspeex_lib_get_mode ( SPEEX_MODEID_UWB ) ;
2010-11-15 02:40:31 +00:00
2013-05-31 01:16:07 +00:00
s_voip . speex . loaded = true ;
return s_voip . speex . loaded ;
}
# endif
2010-11-15 02:40:31 +00:00
2019-04-16 22:40:05 +00:00
# ifdef AVAIL_OPENAL
extern snd_capture_driver_t OPENAL_Capture ;
2013-05-31 01:16:07 +00:00
# endif
2020-07-01 05:32:21 +00:00
# ifdef _WIN32
snd_capture_driver_t fte_weakstruct DSOUND_Capture ;
# endif
snd_capture_driver_t fte_weakstruct OSS_Capture ;
snd_capture_driver_t fte_weakstruct SDL_Capture ;
2013-05-31 01:16:07 +00:00
2019-04-16 22:40:05 +00:00
snd_capture_driver_t * capturedrivers [ ] =
{
2020-07-01 05:32:21 +00:00
# ifdef _WIN32
2019-04-16 22:40:05 +00:00
& DSOUND_Capture ,
2020-07-01 05:32:21 +00:00
# endif
2019-04-16 22:40:05 +00:00
& SDL_Capture ,
& OSS_Capture ,
# ifdef AVAIL_OPENAL
& OPENAL_Capture ,
# endif
NULL
} ;
2010-11-15 02:40:31 +00:00
2017-06-21 01:24:25 +00:00
size_t PCMA_Decode ( short * out , unsigned char * in , size_t samples )
{
size_t i = 0 ;
for ( i = 0 ; i < samples ; i + + )
{
unsigned char inv = in [ i ] ^ 0x55 ; //g711 alaw inverts every other bit
int m = inv & 0xf ;
int e = ( inv & 0x70 ) > > 4 ;
if ( e )
m = ( ( ( m ) < < 1 ) | 0x21 ) < < ( e - 1 ) ;
else
m = ( ( ( m ) < < 1 ) | 1 ) ;
if ( inv & 0x80 )
out [ i ] = - m ;
else
out [ i ] = m ;
}
return i ;
}
size_t PCMA_Encode ( unsigned char * out , size_t outsize , short * in , size_t samples )
{
size_t i = 0 ;
for ( i = 0 ; i < samples ; i + + )
{
int o = in [ i ] ;
unsigned char b ;
if ( o < 0 )
{
o = - o ;
b = 0x80 ;
}
else
b = 0 ;
if ( o > = 0x0800 )
b | = ( ( o > > 7 ) & 0xf ) | 0x70 ;
else if ( o > = 0x0400 )
b | = ( ( o > > 6 ) & 0xf ) | 0x60 ;
else if ( o > = 0x0200 )
b | = ( ( o > > 5 ) & 0xf ) | 0x50 ;
else if ( o > = 0x0100 )
b | = ( ( o > > 4 ) & 0xf ) | 0x40 ;
else if ( o > = 0x0080 )
b | = ( ( o > > 3 ) & 0xf ) | 0x30 ;
else if ( o > = 0x0040 )
b | = ( ( o > > 2 ) & 0xf ) | 0x20 ;
else if ( o > = 0x0020 )
b | = ( ( o > > 1 ) & 0xf ) | 0x10 ;
else
b | = ( ( o > > 1 ) & 0xf ) | 0x00 ;
out [ i ] = b ^ 0x55 ; //invert every-other bit.
}
return samples ;
}
size_t PCMU_Decode ( short * out , unsigned char * in , size_t samples )
{
size_t i = 0 ;
for ( i = 0 ; i < samples ; i + + )
{
unsigned char inv = in [ i ] ^ 0xff ;
int m = ( ( ( inv & 0xf ) < < 1 ) | 0x21 ) < < ( ( inv & 0x70 ) > > 4 ) ;
m - = 33 ;
if ( inv & 0x80 )
out [ i ] = - m ;
else
out [ i ] = m ;
}
return i ;
}
size_t PCMU_Encode ( unsigned char * out , size_t outsize , short * in , size_t samples )
{
size_t i = 0 ;
for ( i = 0 ; i < samples ; i + + )
{
int o = in [ i ] ;
unsigned char b ;
if ( o < 0 )
{
o = ~ o ;
b = 0x80 ;
}
else
b = 0 ;
o + = 33 ;
if ( o > = 0x1000 )
b | = ( ( o > > 8 ) & 0xf ) | 0x70 ;
else if ( o > = 0x0800 )
b | = ( ( o > > 7 ) & 0xf ) | 0x60 ;
else if ( o > = 0x0400 )
b | = ( ( o > > 6 ) & 0xf ) | 0x50 ;
else if ( o > = 0x0200 )
b | = ( ( o > > 5 ) & 0xf ) | 0x40 ;
else if ( o > = 0x0100 )
b | = ( ( o > > 4 ) & 0xf ) | 0x30 ;
else if ( o > = 0x0080 )
b | = ( ( o > > 3 ) & 0xf ) | 0x20 ;
else if ( o > = 0x0040 )
b | = ( ( o > > 2 ) & 0xf ) | 0x10 ;
else
b | = ( ( o > > 1 ) & 0xf ) | 0x00 ;
out [ i ] = b ^ 0xff ;
}
return samples ;
}
2013-05-31 01:16:07 +00:00
void S_Voip_Decode ( unsigned int sender , unsigned int codec , unsigned int gen , unsigned char seq , unsigned int bytes , unsigned char * data )
2010-11-15 02:40:31 +00:00
{
2013-05-31 01:16:07 +00:00
unsigned char * start ;
short decodebuf [ 8192 ] ;
2013-06-23 03:59:48 +00:00
unsigned int decodesamps , len , drops ;
2013-05-31 01:16:07 +00:00
int r ;
2010-11-20 22:01:16 +00:00
2013-05-31 01:16:07 +00:00
if ( sender > = MAX_CLIENTS )
2010-11-15 02:40:31 +00:00
return ;
2010-11-16 02:03:47 +00:00
2010-11-15 02:40:31 +00:00
decodesamps = 0 ;
drops = 0 ;
start = data ;
2010-11-20 22:01:16 +00:00
2013-05-31 01:16:07 +00:00
s_voip . lastspoke [ sender ] = realtime + 0.5 ;
if ( s_voip . lastspoke [ sender ] > s_voip . lastspoke_any )
s_voip . lastspoke_any = s_voip . lastspoke [ sender ] ;
//if they re-started speaking, flush any old state to avoid things getting weirdly delayed and reset the codec properly.
if ( s_voip . decgen [ sender ] ! = gen | | s_voip . deccodec [ sender ] ! = codec )
2010-11-20 22:01:16 +00:00
{
2013-05-31 01:16:07 +00:00
S_RawAudio ( sender , NULL , s_voip . decsamplerate [ sender ] , 0 , 1 , 2 , 0 ) ;
if ( s_voip . deccodec [ sender ] ! = codec )
{
//make sure old state is closed properly.
switch ( s_voip . deccodec [ sender ] )
{
2019-04-17 00:50:14 +00:00
# ifdef HAVE_SPEEX
2013-06-29 16:01:07 +00:00
case VOIP_SPEEX_OLD :
case VOIP_SPEEX_NARROW :
case VOIP_SPEEX_WIDE :
2013-08-21 07:14:39 +00:00
case VOIP_SPEEX_ULTRAWIDE :
2013-05-31 01:16:07 +00:00
qspeex_decoder_destroy ( s_voip . decoder [ sender ] ) ;
break ;
2019-04-17 00:50:14 +00:00
# endif
2017-01-17 19:04:09 +00:00
case VOIP_RAW16 :
2013-07-26 17:19:06 +00:00
break ;
2019-04-17 00:50:14 +00:00
# ifdef HAVE_OPUS
2013-05-31 01:16:07 +00:00
case VOIP_OPUS :
qopus_decoder_destroy ( s_voip . decoder [ sender ] ) ;
break ;
2019-04-17 00:50:14 +00:00
# endif
2013-05-31 01:16:07 +00:00
}
s_voip . decoder [ sender ] = NULL ;
s_voip . deccodec [ sender ] = VOIP_INVALID ;
}
switch ( codec )
{
default : //codec not supported.
return ;
2017-01-17 19:04:09 +00:00
case VOIP_RAW16 :
2013-07-26 17:19:06 +00:00
s_voip . decsamplerate [ sender ] = 11025 ;
break ;
2017-06-21 01:24:25 +00:00
case VOIP_PCMA :
case VOIP_PCMU :
s_voip . decsamplerate [ sender ] = 8000 ;
s_voip . decframesize [ sender ] = 8000 / 20 ;
break ;
2019-04-17 00:50:14 +00:00
# ifdef HAVE_SPEEX
2013-06-29 16:01:07 +00:00
case VOIP_SPEEX_OLD :
case VOIP_SPEEX_NARROW :
case VOIP_SPEEX_WIDE :
2013-08-21 07:14:39 +00:00
case VOIP_SPEEX_ULTRAWIDE :
2013-07-26 17:19:06 +00:00
{
2013-08-21 07:14:39 +00:00
const SpeexMode * smode ;
if ( ! S_Speex_Init ( ) )
return ; //speex not usable.
if ( codec = = VOIP_SPEEX_NARROW )
{
s_voip . decsamplerate [ sender ] = 8000 ;
s_voip . decframesize [ sender ] = 160 ;
smode = s_voip . speex . modenb ;
}
else if ( codec = = VOIP_SPEEX_WIDE )
{
s_voip . decsamplerate [ sender ] = 16000 ;
s_voip . decframesize [ sender ] = 320 ;
smode = s_voip . speex . modewb ;
}
2013-10-26 02:49:28 +00:00
else if ( codec = = VOIP_SPEEX_ULTRAWIDE )
2013-08-21 07:14:39 +00:00
{
s_voip . decsamplerate [ sender ] = 32000 ;
s_voip . decframesize [ sender ] = 640 ;
smode = s_voip . speex . modeuwb ;
}
else
{
s_voip . decsamplerate [ sender ] = 11025 ;
s_voip . decframesize [ sender ] = 160 ;
smode = s_voip . speex . modenb ;
}
2013-05-31 01:16:07 +00:00
if ( ! s_voip . decoder [ sender ] )
2013-08-21 07:14:39 +00:00
{
qspeex_bits_init ( & s_voip . speex . decbits [ sender ] ) ;
qspeex_bits_reset ( & s_voip . speex . decbits [ sender ] ) ;
s_voip . decoder [ sender ] = qspeex_decoder_init ( smode ) ;
if ( ! s_voip . decoder [ sender ] )
return ;
}
else
qspeex_bits_reset ( & s_voip . speex . decbits [ sender ] ) ;
2013-05-31 01:16:07 +00:00
}
break ;
2019-04-17 00:50:14 +00:00
# endif
# ifdef HAVE_OPUS
2013-05-31 01:16:07 +00:00
case VOIP_OPUS :
if ( ! S_Opus_Init ( ) )
return ;
//the lazy way to reset the codec!
if ( ! s_voip . decoder [ sender ] )
{
//opus outputs to 8, 12, 16, 24, or 48khz. pick whichever has least excess samples and resample to fit it.
if ( snd_speed < = 8000 )
s_voip . decsamplerate [ sender ] = 8000 ;
else if ( snd_speed < = 12000 )
s_voip . decsamplerate [ sender ] = 12000 ;
else if ( snd_speed < = 16000 )
s_voip . decsamplerate [ sender ] = 16000 ;
else if ( snd_speed < = 24000 )
s_voip . decsamplerate [ sender ] = 24000 ;
else
s_voip . decsamplerate [ sender ] = 48000 ;
s_voip . decoder [ sender ] = qopus_decoder_create ( s_voip . decsamplerate [ sender ] , 1 /*FIXME: support stereo where possible*/ , NULL ) ;
if ( ! s_voip . decoder [ sender ] )
return ;
2013-07-26 17:19:06 +00:00
2017-01-17 19:04:09 +00:00
s_voip . decframesize [ sender ] = s_voip . decsamplerate [ sender ] / 400 ; //this is the maximum size in a single frame.
2013-05-31 01:16:07 +00:00
}
else
qopus_decoder_ctl ( s_voip . decoder [ sender ] , OPUS_RESET_STATE ) ;
break ;
2019-04-17 00:50:14 +00:00
# endif
2013-05-31 01:16:07 +00:00
}
s_voip . deccodec [ sender ] = codec ;
s_voip . decgen [ sender ] = gen ;
s_voip . decseq [ sender ] = seq ;
2018-11-22 03:02:36 +00:00
s_voip . declevel [ sender ] = 0 ;
2010-11-20 22:01:16 +00:00
}
2013-05-31 04:15:41 +00:00
//if there's packetloss, tell the decoder about the missing parts.
//no infinite loops please.
if ( ( unsigned ) ( seq - s_voip . decseq [ sender ] ) > 10 )
s_voip . decseq [ sender ] = seq - 10 ;
while ( s_voip . decseq [ sender ] ! = seq )
{
if ( decodesamps + s_voip . decframesize [ sender ] > sizeof ( decodebuf ) / sizeof ( decodebuf [ 0 ] ) )
{
2013-09-06 22:57:44 +00:00
S_RawAudio ( sender , ( qbyte * ) decodebuf , s_voip . decsamplerate [ sender ] , decodesamps , 1 , 2 , snd_voip_play . value ) ;
2013-05-31 04:15:41 +00:00
decodesamps = 0 ;
}
switch ( codec )
{
2017-08-14 16:38:44 +00:00
case VOIP_RAW16 :
case VOIP_PCMA :
case VOIP_PCMU :
break ;
2019-04-17 00:50:14 +00:00
# ifdef HAVE_SPEEX
2013-06-29 16:01:07 +00:00
case VOIP_SPEEX_OLD :
case VOIP_SPEEX_NARROW :
case VOIP_SPEEX_WIDE :
2013-08-21 07:14:39 +00:00
case VOIP_SPEEX_ULTRAWIDE :
2013-05-31 04:15:41 +00:00
qspeex_decode_int ( s_voip . decoder [ sender ] , NULL , decodebuf + decodesamps ) ;
decodesamps + = s_voip . decframesize [ sender ] ;
break ;
2019-04-17 00:50:14 +00:00
# endif
# ifdef HAVE_OPUS
2013-05-31 04:15:41 +00:00
case VOIP_OPUS :
2013-07-26 17:19:06 +00:00
r = qopus_decode ( s_voip . decoder [ sender ] , NULL , 0 , decodebuf + decodesamps , min ( s_voip . decframesize [ sender ] , sizeof ( decodebuf ) / sizeof ( decodebuf [ 0 ] ) - decodesamps ) , false ) ;
2013-05-31 04:15:41 +00:00
if ( r > 0 )
decodesamps + = r ;
break ;
2019-04-17 00:50:14 +00:00
# endif
2013-05-31 04:15:41 +00:00
}
s_voip . decseq [ sender ] + + ;
}
2010-11-15 02:40:31 +00:00
while ( bytes > 0 )
{
2013-07-26 17:19:06 +00:00
if ( decodesamps + s_voip . decframesize [ sender ] > = sizeof ( decodebuf ) / sizeof ( decodebuf [ 0 ] ) )
2010-11-15 02:40:31 +00:00
{
2013-09-06 22:57:44 +00:00
S_RawAudio ( sender , ( qbyte * ) decodebuf , s_voip . decsamplerate [ sender ] , decodesamps , 1 , 2 , snd_voip_play . value ) ;
2010-11-15 02:40:31 +00:00
decodesamps = 0 ;
}
2013-05-31 01:16:07 +00:00
switch ( codec )
2010-11-15 02:40:31 +00:00
{
2013-05-31 01:16:07 +00:00
default :
bytes = 0 ;
break ;
2019-04-16 22:40:05 +00:00
# ifdef HAVE_SPEEX
2013-06-29 16:01:07 +00:00
case VOIP_SPEEX_OLD :
case VOIP_SPEEX_NARROW :
case VOIP_SPEEX_WIDE :
2013-08-21 07:14:39 +00:00
case VOIP_SPEEX_ULTRAWIDE :
2013-06-29 16:01:07 +00:00
if ( codec = = VOIP_SPEEX_OLD )
{ //older versions support only this, and require this extra bit.
bytes - - ;
len = * start + + ;
if ( bytes < len )
break ;
}
else
len = bytes ;
2013-05-31 04:15:41 +00:00
qspeex_bits_read_from ( & s_voip . speex . decbits [ sender ] , start , len ) ;
bytes - = len ;
start + = len ;
2013-06-29 16:01:07 +00:00
while ( qspeex_decode_int ( s_voip . decoder [ sender ] , & s_voip . speex . decbits [ sender ] , decodebuf + decodesamps ) = = 0 )
{
decodesamps + = s_voip . decframesize [ sender ] ;
s_voip . decseq [ sender ] + + ;
seq + + ;
2013-07-26 17:19:06 +00:00
if ( decodesamps + s_voip . decframesize [ sender ] > = sizeof ( decodebuf ) / sizeof ( decodebuf [ 0 ] ) )
2013-06-29 16:01:07 +00:00
{
2013-09-06 22:57:44 +00:00
S_RawAudio ( sender , ( qbyte * ) decodebuf , s_voip . decsamplerate [ sender ] , decodesamps , 1 , 2 , snd_voip_play . value ) ;
2013-06-29 16:01:07 +00:00
decodesamps = 0 ;
}
}
2013-05-31 01:16:07 +00:00
break ;
2019-04-16 22:40:05 +00:00
# endif
2017-01-17 19:04:09 +00:00
case VOIP_RAW16 :
2013-07-26 17:19:06 +00:00
len = min ( bytes , sizeof ( decodebuf ) - ( sizeof ( decodebuf [ 0 ] ) * decodesamps ) ) ;
memcpy ( decodebuf + decodesamps , start , len ) ;
decodesamps + = len / sizeof ( decodebuf [ 0 ] ) ;
s_voip . decseq [ sender ] + + ;
bytes - = len ;
start + = len ;
break ;
2017-06-21 01:24:25 +00:00
case VOIP_PCMA :
case VOIP_PCMU :
len = min ( bytes , sizeof ( decodebuf ) - ( sizeof ( decodebuf [ 0 ] ) * decodesamps ) ) ;
if ( len > s_voip . decframesize [ sender ] * 2 )
len = s_voip . decframesize [ sender ] * 2 ;
if ( codec = = VOIP_PCMA )
decodesamps + = PCMA_Decode ( decodebuf + decodesamps , start , len ) ;
else
decodesamps + = PCMU_Decode ( decodebuf + decodesamps , start , len ) ;
s_voip . decseq [ sender ] + + ;
bytes - = len ;
start + = len ;
break ;
2019-04-16 22:40:05 +00:00
# ifdef HAVE_OPUS
2013-05-31 01:16:07 +00:00
case VOIP_OPUS :
2013-07-26 17:19:06 +00:00
len = bytes ;
if ( decodesamps > 0 )
{
2013-09-06 22:57:44 +00:00
S_RawAudio ( sender , ( qbyte * ) decodebuf , s_voip . decsamplerate [ sender ] , decodesamps , 1 , 2 , snd_voip_play . value ) ;
2013-07-26 17:19:06 +00:00
decodesamps = 0 ;
}
r = qopus_decode ( s_voip . decoder [ sender ] , start , len , decodebuf + decodesamps , sizeof ( decodebuf ) / sizeof ( decodebuf [ 0 ] ) - decodesamps , false ) ;
2013-08-21 07:14:39 +00:00
// Con_Printf("Decoded %i frames from %i bytes\n", r, len);
2013-07-26 17:19:06 +00:00
if ( r > 0 )
{
2017-01-17 19:04:09 +00:00
int frames = r / s_voip . decframesize [ sender ] ;
2013-07-26 17:19:06 +00:00
decodesamps + = r ;
2017-01-17 19:04:09 +00:00
s_voip . decseq [ sender ] = ( s_voip . decseq [ sender ] + frames ) & 0xff ;
seq = ( seq + frames ) & 0xff ;
2013-07-26 17:19:06 +00:00
}
else if ( r < 0 )
Con_Printf ( " Opus decoding error %i \n " , r ) ;
bytes - = len ;
start + = len ;
2013-05-31 01:16:07 +00:00
break ;
2019-04-16 22:40:05 +00:00
# endif
2010-11-16 02:03:47 +00:00
}
2010-11-15 02:40:31 +00:00
}
if ( drops )
2010-11-15 03:37:29 +00:00
Con_DPrintf ( " %i dropped audio frames \n " , drops ) ;
2010-11-15 02:40:31 +00:00
if ( decodesamps > 0 )
2018-11-22 03:02:36 +00:00
{ //calculate levels of other people. eukara demanded this.
2018-11-27 16:48:19 +00:00
float level = 0 ;
2018-11-22 03:02:36 +00:00
float f ;
for ( len = 0 ; len < decodesamps ; len + + )
{
f = decodebuf [ len ] ;
level + = f * f ;
}
level = ( 3000 * level ) / ( 32767.0f * 32767 * decodesamps ) ;
s_voip . declevel [ sender ] = ( s_voip . declevel [ sender ] * 7 + level ) / 8 ;
2013-09-06 22:57:44 +00:00
S_RawAudio ( sender , ( qbyte * ) decodebuf , s_voip . decsamplerate [ sender ] , decodesamps , 1 , 2 , snd_voip_play . value ) ;
2018-11-22 03:02:36 +00:00
}
2010-11-15 02:40:31 +00:00
}
2013-06-29 16:01:07 +00:00
# ifdef SUPPORT_ICE
2017-06-21 01:24:25 +00:00
static int S_Voip_NameToId ( const char * codec )
{
if ( ! Q_strcasecmp ( codec , " speex@8000 " ) )
return VOIP_SPEEX_NARROW ;
else if ( ! Q_strcasecmp ( codec , " speex@11025 " ) )
return VOIP_SPEEX_OLD ;
else if ( ! Q_strcasecmp ( codec , " speex@16000 " ) )
return VOIP_SPEEX_WIDE ;
else if ( ! Q_strcasecmp ( codec , " speex@32000 " ) )
return VOIP_SPEEX_ULTRAWIDE ;
else if ( ! Q_strcasecmp ( codec , " opus " ) | | ! strcmp ( codec , " opus@48000 " ) )
return VOIP_OPUS ;
else if ( ! Q_strcasecmp ( codec , " pcma@8000 " ) )
return VOIP_PCMA ;
else if ( ! Q_strcasecmp ( codec , " pcmu@8000 " ) )
return VOIP_PCMU ;
else
return VOIP_INVALID ;
}
2015-08-22 02:59:01 +00:00
qboolean S_Voip_RTP_CodecOkay ( const char * codec )
2013-08-21 07:14:39 +00:00
{
2017-06-21 01:24:25 +00:00
switch ( S_Voip_NameToId ( codec ) )
2013-08-21 07:14:39 +00:00
{
2019-04-17 00:50:14 +00:00
# ifdef HAVE_SPEEX
2017-06-21 01:24:25 +00:00
case VOIP_SPEEX_NARROW :
case VOIP_SPEEX_OLD :
case VOIP_SPEEX_WIDE :
case VOIP_SPEEX_ULTRAWIDE :
return S_Speex_Init ( ) ;
2019-04-17 00:50:14 +00:00
# endif
2017-06-21 01:24:25 +00:00
case VOIP_PCMA :
case VOIP_PCMU :
return true ;
2019-04-17 00:50:14 +00:00
# ifdef HAVE_OPUS
2017-06-21 01:24:25 +00:00
case VOIP_OPUS :
return S_Opus_Init ( ) ;
2019-04-17 00:50:14 +00:00
# endif
2017-06-21 01:24:25 +00:00
default :
return false ;
2013-08-21 07:14:39 +00:00
}
}
2013-06-29 16:01:07 +00:00
void S_Voip_RTP_Parse ( unsigned short sequence , char * codec , unsigned char * data , unsigned int datalen )
{
2017-06-21 01:24:25 +00:00
S_Voip_Decode ( MAX_CLIENTS - 1 , S_Voip_NameToId ( codec ) , 0 , sequence & 0xff , datalen , data ) ;
2013-06-29 16:01:07 +00:00
}
2013-08-21 07:14:39 +00:00
qboolean NET_RTP_Transmit ( unsigned int sequence , unsigned int timestamp , const char * codec , char * cdata , int clength ) ;
2013-06-29 16:01:07 +00:00
qboolean NET_RTP_Active ( void ) ;
# else
# define NET_RTP_Active() false
# endif
2013-05-31 01:16:07 +00:00
void S_Voip_Parse ( void )
{
unsigned int sender ;
unsigned int bytes ;
unsigned char data [ 1024 ] ;
unsigned char seq , gen ;
unsigned char codec ;
sender = MSG_ReadByte ( ) ;
gen = MSG_ReadByte ( ) ;
codec = gen > > 4 ;
gen & = 0x0f ;
seq = MSG_ReadByte ( ) ;
bytes = MSG_ReadShort ( ) ;
2013-09-06 22:57:44 +00:00
if ( bytes > sizeof ( data ) | | snd_voip_play . value < = 0 )
2013-05-31 01:16:07 +00:00
{
MSG_ReadSkip ( bytes ) ;
return ;
}
MSG_ReadData ( data , bytes ) ;
sender % = MAX_CLIENTS ;
//if testing, don't get confused if the server is echoing voice too!
2013-09-06 22:57:44 +00:00
if ( snd_voip_test . ival )
2013-06-23 02:17:02 +00:00
if ( sender = = cl . playerview [ 0 ] . playernum )
2013-05-31 01:16:07 +00:00
return ;
S_Voip_Decode ( sender , codec , gen , seq , bytes , data ) ;
}
2013-07-26 17:19:06 +00:00
static float S_Voip_Preprocess ( short * start , unsigned int samples , float micamp )
{
int i ;
float level = 0 , f ;
int framesize = s_voip . encframesize ;
while ( samples > = framesize )
{
2019-04-17 00:50:14 +00:00
# ifdef HAVE_SPEEX
2013-07-26 17:19:06 +00:00
if ( s_voip . speexdsp . preproc )
qspeex_preprocess_run ( s_voip . speexdsp . preproc , start ) ;
2019-04-17 00:50:14 +00:00
# endif
2013-07-26 17:19:06 +00:00
for ( i = 0 ; i < framesize ; i + + )
{
f = start [ i ] * micamp ;
2013-08-21 07:14:39 +00:00
start [ i ] = bound ( - 32768 , f , 32767 ) ; //clamp it carefully, so it doesn't go to crap when given far too high a mic amp
2013-07-26 17:19:06 +00:00
level + = f * f ;
}
start + = framesize ;
samples - = framesize ;
}
return level ;
}
2013-09-06 22:57:44 +00:00
static void S_Voip_TryInitCaptureContext ( char * driver , char * device , int rate )
{
int i ;
2013-10-26 02:49:28 +00:00
s_voip . cdriver = NULL ;
2013-09-06 22:57:44 +00:00
/*Add new drivers in order of priority*/
for ( i = 0 ; capturedrivers [ i ] ; i + + )
{
2013-10-26 02:49:28 +00:00
if ( capturedrivers [ i ] - > Init & & ( ! driver | | ! strcmp ( capturedrivers [ i ] - > drivername , driver ) ) )
2013-09-06 22:57:44 +00:00
{
s_voip . cdriver = capturedrivers [ i ] ;
2013-10-26 02:49:28 +00:00
s_voip . cdriverctx = s_voip . cdriver - > Init ( s_voip . encsamplerate , device ) ;
if ( s_voip . cdriverctx )
{
//success!
return ;
}
2013-09-06 22:57:44 +00:00
}
}
2013-10-26 02:49:28 +00:00
if ( ! s_voip . cdriver )
2013-09-06 22:57:44 +00:00
{
2013-10-26 02:49:28 +00:00
if ( ! driver )
Con_Printf ( " No microphone drivers supported \n " ) ;
else
Con_Printf ( " Microphone driver \" %s \" is not valid \n " , driver ) ;
2013-09-06 22:57:44 +00:00
}
2013-10-26 02:49:28 +00:00
else
Con_Printf ( " No microphone detected \n " ) ;
s_voip . cdriver = NULL ;
2013-09-06 22:57:44 +00:00
}
static void S_Voip_InitCaptureContext ( int rate )
{
char * s ;
s_voip . cdriver = NULL ;
s_voip . cdriverctx = NULL ;
for ( s = snd_voip_capturedevice . string ; ; )
{
char * sep ;
s = COM_Parse ( s ) ;
if ( ! * com_token )
break ;
sep = strchr ( com_token , ' : ' ) ;
if ( sep )
* sep + + = 0 ;
S_Voip_TryInitCaptureContext ( com_token , sep , rate ) ;
}
2013-10-26 02:49:28 +00:00
if ( ! s_voip . cdriver )
2013-09-06 22:57:44 +00:00
S_Voip_TryInitCaptureContext ( NULL , NULL , rate ) ;
}
2010-11-20 22:01:16 +00:00
void S_Voip_Transmit ( unsigned char clc , sizebuf_t * buf )
2010-11-15 02:40:31 +00:00
{
2013-05-31 01:16:07 +00:00
unsigned char outbuf [ 8192 ] ;
2010-11-15 02:40:31 +00:00
unsigned int outpos ; //in bytes
unsigned int encpos ; //in bytes
2010-11-20 22:01:16 +00:00
short * start ;
2013-06-29 16:01:07 +00:00
unsigned int initseq ; //in frames
2017-02-19 00:15:42 +00:00
# ifdef SUPPORT_ICE
2013-06-29 16:01:07 +00:00
unsigned int inittimestamp ; //in samples
2017-02-19 00:15:42 +00:00
# endif
2010-11-20 22:01:16 +00:00
unsigned int samps ;
2013-07-26 17:19:06 +00:00
float level ;
2013-05-31 01:16:07 +00:00
int len ;
2013-09-06 22:57:44 +00:00
float micamp = snd_voip_micamp . value ;
2010-11-20 22:01:16 +00:00
qboolean voipsendenable = true ;
2017-01-17 19:04:09 +00:00
int voipcodec = * snd_voip_codec . string ? snd_voip_codec . ival : VOIP_DEFAULT_CODEC ;
2013-06-29 16:01:07 +00:00
qboolean rtpstream = NET_RTP_Active ( ) ;
2010-11-20 22:01:16 +00:00
2013-05-31 01:16:07 +00:00
if ( buf )
{
/*if you're sending sound, you should be prepared to accept others yelling at you to shut up*/
2013-09-06 22:57:44 +00:00
if ( snd_voip_play . value < = 0 )
2013-05-31 01:16:07 +00:00
voipsendenable = false ;
2014-11-05 05:39:24 +00:00
/*don't send sound if its not supported. that'll break stuff*/
2013-05-31 01:16:07 +00:00
if ( ! ( cls . fteprotocolextensions2 & PEXT2_VOICECHAT ) )
voipsendenable = false ;
}
else
2014-11-05 05:39:24 +00:00
{
/*we're not sending it to a server. the above considerations don't matter*/
2013-09-06 22:57:44 +00:00
voipsendenable = snd_voip_test . ival ;
2014-11-05 05:39:24 +00:00
}
/*don't send sound if mic volume won't send anything anyway*/
if ( micamp < = 0 )
voipsendenable = false ;
2013-06-29 16:01:07 +00:00
if ( rtpstream )
{
voipsendenable = true ;
//if rtp streaming is enabled, hack the codec to something better supported
2019-04-16 22:40:05 +00:00
# ifdef HAVE_SPEEX
2013-06-29 16:01:07 +00:00
if ( voipcodec = = VOIP_SPEEX_OLD )
2013-08-21 07:14:39 +00:00
voipcodec = VOIP_SPEEX_WIDE ;
2019-04-16 22:40:05 +00:00
# endif
2013-06-29 16:01:07 +00:00
}
2010-11-15 02:40:31 +00:00
2013-09-06 22:57:44 +00:00
voicevolumemod = s_voip . lastspoke_any > realtime ? snd_voip_ducking . value : 1 ;
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
voicevolumemod * = mastervolume . value ;
2013-05-31 01:16:07 +00:00
if ( ! voipsendenable | | ( voipcodec ! = s_voip . enccodec & & s_voip . cdriver ) )
2005-08-03 23:14:59 +00:00
{
2013-05-31 01:16:07 +00:00
if ( s_voip . cdriver )
{
if ( s_voip . cdriverctx )
{
if ( s_voip . wantsend )
{
s_voip . cdriver - > Stop ( s_voip . cdriverctx ) ;
s_voip . wantsend = false ;
}
s_voip . cdriver - > Shutdown ( s_voip . cdriverctx ) ;
s_voip . cdriverctx = NULL ;
}
s_voip . cdriver = NULL ;
}
switch ( s_voip . enccodec )
2010-11-20 22:01:16 +00:00
{
2019-04-16 22:40:05 +00:00
# ifdef HAVE_SPEEX
2013-06-29 16:01:07 +00:00
case VOIP_SPEEX_OLD :
case VOIP_SPEEX_NARROW :
case VOIP_SPEEX_WIDE :
2013-08-21 07:14:39 +00:00
case VOIP_SPEEX_ULTRAWIDE :
2013-05-31 01:16:07 +00:00
break ;
2019-04-16 22:40:05 +00:00
# endif
# ifdef HAVE_OPUS
2013-05-31 01:16:07 +00:00
case VOIP_OPUS :
qopus_encoder_destroy ( s_voip . encoder ) ;
break ;
2019-04-16 22:40:05 +00:00
# endif
2010-11-20 22:01:16 +00:00
}
2013-05-31 01:16:07 +00:00
s_voip . encoder = NULL ;
s_voip . enccodec = VOIP_INVALID ;
if ( ! voipsendenable )
return ;
2010-11-15 02:40:31 +00:00
}
2010-11-20 22:01:16 +00:00
2013-09-06 22:57:44 +00:00
voipsendenable = voipbutton | | ( snd_voip_send . ival > 0 ) ;
2010-11-20 22:01:16 +00:00
2013-05-31 01:16:07 +00:00
if ( ! s_voip . cdriver )
2010-11-15 02:40:31 +00:00
{
2013-05-31 01:16:07 +00:00
s_voip . voiplevel = - 1 ;
2010-11-20 22:01:16 +00:00
/*only init the first time capturing is requested*/
if ( ! voipsendenable )
return ;
2013-05-31 01:16:07 +00:00
/*see if we can init our encoding codec...*/
switch ( voipcodec )
{
2019-04-16 22:40:05 +00:00
# ifdef HAVE_SPEEX
2013-06-29 16:01:07 +00:00
case VOIP_SPEEX_OLD :
case VOIP_SPEEX_NARROW :
case VOIP_SPEEX_WIDE :
2013-08-21 07:14:39 +00:00
case VOIP_SPEEX_ULTRAWIDE :
2013-05-31 01:16:07 +00:00
{
2013-08-21 07:14:39 +00:00
const SpeexMode * smode ;
if ( ! S_Speex_Init ( ) )
{
Con_Printf ( " Unable to use speex codec - not installed \n " ) ;
return ;
}
2013-05-31 01:16:07 +00:00
2013-08-21 07:14:39 +00:00
if ( voipcodec = = VOIP_SPEEX_ULTRAWIDE )
smode = s_voip . speex . modeuwb ;
else if ( voipcodec = = VOIP_SPEEX_WIDE )
smode = s_voip . speex . modewb ;
else
smode = s_voip . speex . modenb ;
qspeex_bits_init ( & s_voip . speex . encbits ) ;
qspeex_bits_reset ( & s_voip . speex . encbits ) ;
s_voip . encoder = qspeex_encoder_init ( smode ) ;
if ( ! s_voip . encoder )
return ;
qspeex_encoder_ctl ( s_voip . encoder , SPEEX_GET_FRAME_SIZE , & s_voip . encframesize ) ;
qspeex_encoder_ctl ( s_voip . encoder , SPEEX_GET_SAMPLING_RATE , & s_voip . encsamplerate ) ;
if ( voipcodec = = VOIP_SPEEX_NARROW )
s_voip . encsamplerate = 8000 ;
else if ( voipcodec = = VOIP_SPEEX_WIDE )
s_voip . encsamplerate = 16000 ;
else if ( voipcodec = = VOIP_SPEEX_ULTRAWIDE )
s_voip . encsamplerate = 32000 ;
else
s_voip . encsamplerate = 11025 ;
qspeex_encoder_ctl ( s_voip . encoder , SPEEX_SET_SAMPLING_RATE , & s_voip . encsamplerate ) ;
}
2013-05-31 01:16:07 +00:00
break ;
2019-04-16 22:40:05 +00:00
# endif
2017-06-21 01:24:25 +00:00
case VOIP_PCMA :
case VOIP_PCMU :
s_voip . encsamplerate = 8000 ;
s_voip . encframesize = 8000 / 20 ;
break ;
2017-01-17 19:04:09 +00:00
case VOIP_RAW16 :
2013-07-26 17:19:06 +00:00
s_voip . encsamplerate = 11025 ;
s_voip . encframesize = 256 ;
break ;
2019-04-16 22:40:05 +00:00
# ifdef HAVE_OPUS
2013-05-31 01:16:07 +00:00
case VOIP_OPUS :
if ( ! S_Opus_Init ( ) )
{
Con_Printf ( " Unable to use opus codec - not installed \n " ) ;
return ;
}
//use whatever is convienient.
s_voip . encsamplerate = 48000 ;
s_voip . encframesize = s_voip . encsamplerate / 400 ; //2.5ms frames, at a minimum.
s_voip . encoder = qopus_encoder_create ( s_voip . encsamplerate , 1 , OPUS_APPLICATION_VOIP , NULL ) ;
if ( ! s_voip . encoder )
return ;
2016-01-18 05:22:07 +00:00
s_voip . curbitrate = 0 ;
2013-05-31 01:16:07 +00:00
2016-01-18 05:22:07 +00:00
// opus_encoder_ctl(s_voip.encoder, OPUS_SET_BITRATE(bitrate_bps));
// opus_encoder_ctl(s_voip.encoder, OPUS_SET_BANDWIDTH(OPUS_BANDWIDTH_NARROWBAND));
// opus_encoder_ctl(s_voip.encoder, OPUS_SET_VBR(use_vbr));
// opus_encoder_ctl(s_voip.encoder, OPUS_SET_VBR_CONSTRAINT(cvbr));
// opus_encoder_ctl(s_voip.encoder, OPUS_SET_COMPLEXITY(complexity));
// opus_encoder_ctl(s_voip.encoder, OPUS_SET_INBAND_FEC(use_inbandfec));
// opus_encoder_ctl(s_voip.encoder, OPUS_SET_FORCE_CHANNELS(forcechannels));
// opus_encoder_ctl(s_voip.encoder, OPUS_SET_DTX(use_dtx));
// opus_encoder_ctl(s_voip.encoder, OPUS_SET_PACKET_LOSS_PERC(packet_loss_perc));
// opus_encoder_ctl(s_voip.encoder, OPUS_GET_LOOKAHEAD(&skip));
// opus_encoder_ctl(s_voip.encoder, OPUS_SET_LSB_DEPTH(16));
2013-05-31 01:16:07 +00:00
break ;
2019-04-16 22:40:05 +00:00
# endif
2013-05-31 01:16:07 +00:00
default :
Con_Printf ( " Unable to use that codec - not implemented \n " ) ;
//can't start up other coedcs, cos we're too lame.
2010-11-20 22:01:16 +00:00
return ;
2013-05-31 01:16:07 +00:00
}
s_voip . enccodec = voipcodec ;
2013-09-06 22:57:44 +00:00
S_Voip_InitCaptureContext ( s_voip . encsamplerate ) ; //sets cdriver+cdriverctx
2005-08-03 23:14:59 +00:00
}
2010-11-15 02:40:31 +00:00
2010-11-20 22:01:16 +00:00
/*couldn't init a driver?*/
2013-10-26 02:49:28 +00:00
if ( ! s_voip . cdriverctx | | ! s_voip . cdriver )
2010-11-16 02:03:47 +00:00
{
return ;
}
2013-05-31 01:16:07 +00:00
if ( ! voipsendenable & & s_voip . wantsend )
2010-11-20 22:01:16 +00:00
{
2013-05-31 01:16:07 +00:00
s_voip . wantsend = false ;
s_voip . capturepos + = s_voip . cdriver - > Update ( s_voip . cdriverctx , ( unsigned char * ) s_voip . capturebuf + s_voip . capturepos , 1 , sizeof ( s_voip . capturebuf ) - s_voip . capturepos ) ;
s_voip . cdriver - > Stop ( s_voip . cdriverctx ) ;
2010-11-20 22:01:16 +00:00
/*note: we still grab audio to flush everything that was captured while it was active*/
}
2013-05-31 01:16:07 +00:00
else if ( voipsendenable & & ! s_voip . wantsend )
2010-11-20 22:01:16 +00:00
{
2013-05-31 01:16:07 +00:00
s_voip . wantsend = true ;
if ( ! s_voip . capturepos )
2010-11-20 22:01:16 +00:00
{ /*if we were actually still sending, it was probably only off for a single frame, in which case don't reset it*/
2013-05-31 01:16:07 +00:00
s_voip . dumps = 0 ;
s_voip . generation + + ;
s_voip . encsequence = 0 ;
//reset codecs so they start with a clean slate when new audio blocks are generated.
switch ( s_voip . enccodec )
{
2019-04-17 00:50:14 +00:00
# ifdef HAVE_SPEEX
2013-06-29 16:01:07 +00:00
case VOIP_SPEEX_OLD :
case VOIP_SPEEX_NARROW :
case VOIP_SPEEX_WIDE :
2013-08-21 07:14:39 +00:00
case VOIP_SPEEX_ULTRAWIDE :
2013-05-31 01:16:07 +00:00
qspeex_bits_reset ( & s_voip . speex . encbits ) ;
break ;
2019-04-17 00:50:14 +00:00
# endif
2017-01-17 19:04:09 +00:00
case VOIP_RAW16 :
2013-07-26 17:19:06 +00:00
break ;
2019-04-17 00:50:14 +00:00
# ifdef HAVE_OPUS
2013-05-31 01:16:07 +00:00
case VOIP_OPUS :
qopus_encoder_ctl ( s_voip . encoder , OPUS_RESET_STATE ) ;
break ;
2019-04-17 00:50:14 +00:00
# endif
2013-05-31 01:16:07 +00:00
}
2010-11-20 22:01:16 +00:00
}
else
{
2013-05-31 01:16:07 +00:00
s_voip . capturepos + = s_voip . cdriver - > Update ( s_voip . cdriverctx , ( unsigned char * ) s_voip . capturebuf + s_voip . capturepos , 1 , sizeof ( s_voip . capturebuf ) - s_voip . capturepos ) ;
2010-11-20 22:01:16 +00:00
}
2013-05-31 01:16:07 +00:00
s_voip . cdriver - > Start ( s_voip . cdriverctx ) ;
2010-11-20 22:01:16 +00:00
}
2013-05-31 01:16:07 +00:00
if ( s_voip . wantsend )
2013-09-06 22:57:44 +00:00
voicevolumemod = min ( voicevolumemod , snd_voip_capturingvol . value ) ;
2013-05-31 01:16:07 +00:00
s_voip . capturepos + = s_voip . cdriver - > Update ( s_voip . cdriverctx , ( unsigned char * ) s_voip . capturebuf + s_voip . capturepos , s_voip . encframesize * 2 , sizeof ( s_voip . capturebuf ) - s_voip . capturepos ) ;
2010-11-20 22:01:16 +00:00
2013-05-31 01:16:07 +00:00
if ( ! s_voip . wantsend & & s_voip . capturepos < s_voip . encframesize * 2 )
2010-11-20 22:01:16 +00:00
{
2013-05-31 01:16:07 +00:00
s_voip . voiplevel = - 1 ;
s_voip . capturepos = 0 ;
2010-11-15 02:40:31 +00:00
return ;
2010-11-20 22:01:16 +00:00
}
2010-11-15 02:40:31 +00:00
2013-05-31 01:16:07 +00:00
initseq = s_voip . encsequence ;
2017-02-19 00:15:42 +00:00
# ifdef SUPPORT_ICE
2013-06-29 16:01:07 +00:00
inittimestamp = s_voip . enctimestamp ;
2017-02-19 00:15:42 +00:00
# endif
2010-11-20 22:01:16 +00:00
level = 0 ;
samps = 0 ;
2013-05-31 01:16:07 +00:00
//*2 for 16bit audio input.
2013-10-26 02:49:28 +00:00
for ( encpos = 0 , outpos = 0 ; encpos + s_voip . encframesize * 2 < = s_voip . capturepos & & outpos + 256 < sizeof ( outbuf ) ; )
2010-11-15 02:40:31 +00:00
{
2013-05-31 01:16:07 +00:00
start = ( short * ) ( s_voip . capturebuf + encpos ) ;
2010-11-15 02:40:31 +00:00
2019-04-17 00:50:14 +00:00
# ifdef HAVE_SPEEX
2013-09-06 22:57:44 +00:00
if ( snd_voip_noisefilter . ival | | snd_voip_autogain . ival )
2013-05-31 01:16:07 +00:00
{
2013-09-06 22:57:44 +00:00
if ( ! s_voip . speexdsp . preproc | | snd_voip_noisefilter . modified | | snd_voip_noisefilter . modified | | s_voip . speexdsp . curframesize ! = s_voip . encframesize | | s_voip . speexdsp . cursamplerate ! = s_voip . encsamplerate )
2013-05-31 01:16:07 +00:00
{
if ( s_voip . speexdsp . preproc )
qspeex_preprocess_state_destroy ( s_voip . speexdsp . preproc ) ;
s_voip . speexdsp . preproc = NULL ;
if ( S_SpeexDSP_Init ( ) )
{
int i ;
s_voip . speexdsp . preproc = qspeex_preprocess_state_init ( s_voip . encframesize , s_voip . encsamplerate ) ;
2013-09-06 22:57:44 +00:00
i = snd_voip_noisefilter . ival ;
2013-05-31 01:16:07 +00:00
qspeex_preprocess_ctl ( s_voip . speexdsp . preproc , SPEEX_PREPROCESS_SET_DENOISE , & i ) ;
2013-09-06 22:57:44 +00:00
i = snd_voip_autogain . ival ;
2013-05-31 01:16:07 +00:00
qspeex_preprocess_ctl ( s_voip . speexdsp . preproc , SPEEX_PREPROCESS_SET_AGC , & i ) ;
s_voip . speexdsp . curframesize = s_voip . encframesize ;
s_voip . speexdsp . cursamplerate = s_voip . encsamplerate ;
}
}
}
2013-07-26 17:19:06 +00:00
else if ( s_voip . speexdsp . preproc )
2010-11-15 03:37:29 +00:00
{
2013-07-26 17:19:06 +00:00
qspeex_preprocess_state_destroy ( s_voip . speexdsp . preproc ) ;
s_voip . speexdsp . preproc = NULL ;
2010-11-15 03:37:29 +00:00
}
2019-04-17 00:50:14 +00:00
# endif
2010-11-15 03:37:29 +00:00
2013-05-31 01:16:07 +00:00
switch ( s_voip . enccodec )
{
2019-04-16 22:40:05 +00:00
# ifdef HAVE_SPEEX
2013-06-29 16:01:07 +00:00
case VOIP_SPEEX_OLD :
2017-11-14 14:37:04 +00:00
//this is from before I understood speex properly.
2013-07-26 17:19:06 +00:00
level + = S_Voip_Preprocess ( start , s_voip . encframesize , micamp ) ;
2013-05-31 01:16:07 +00:00
qspeex_bits_reset ( & s_voip . speex . encbits ) ;
qspeex_encode_int ( s_voip . encoder , start , & s_voip . speex . encbits ) ;
len = qspeex_bits_write ( & s_voip . speex . encbits , outbuf + ( outpos + 1 ) , sizeof ( outbuf ) - ( outpos + 1 ) ) ;
if ( len < 0 | | len > 255 )
len = 0 ;
outbuf [ outpos ] = len ;
outpos + = 1 + len ;
2013-06-29 16:01:07 +00:00
s_voip . encsequence + + ;
samps + = s_voip . encframesize ;
encpos + = s_voip . encframesize * 2 ;
break ;
case VOIP_SPEEX_NARROW :
case VOIP_SPEEX_WIDE :
2013-08-21 07:14:39 +00:00
case VOIP_SPEEX_ULTRAWIDE :
2017-11-14 14:37:04 +00:00
//write multiple speex frames into a single merged frame
2013-06-29 16:01:07 +00:00
qspeex_bits_reset ( & s_voip . speex . encbits ) ;
2013-10-26 02:49:28 +00:00
for ( ; encpos + s_voip . encframesize * 2 < = s_voip . capturepos ; )
2013-06-29 16:01:07 +00:00
{
start = ( short * ) ( s_voip . capturebuf + encpos ) ;
2013-07-26 17:19:06 +00:00
level + = S_Voip_Preprocess ( start , s_voip . encframesize , micamp ) ;
2013-06-29 16:01:07 +00:00
qspeex_encode_int ( s_voip . encoder , start , & s_voip . speex . encbits ) ;
s_voip . encsequence + + ;
samps + = s_voip . encframesize ;
encpos + = s_voip . encframesize * 2 ;
2013-07-26 17:19:06 +00:00
if ( rtpstream ) //FIXME: why?
2013-06-29 16:01:07 +00:00
break ;
}
len = qspeex_bits_write ( & s_voip . speex . encbits , outbuf + outpos , sizeof ( outbuf ) - outpos ) ;
outpos + = len ;
2013-05-31 01:16:07 +00:00
break ;
2019-04-16 22:40:05 +00:00
# endif
2017-01-17 19:04:09 +00:00
case VOIP_RAW16 :
2013-07-26 17:19:06 +00:00
len = s_voip . capturepos - encpos ; //amount of data to be eaten in this frame
len = min ( len , sizeof ( outbuf ) - outpos ) ;
len & = ~ ( ( s_voip . encframesize * 2 ) - 1 ) ;
level + = S_Voip_Preprocess ( start , len / 2 , micamp ) ;
memcpy ( outbuf + outpos , start , len ) ; //'encode'
outpos + = len ; //bytes written to output
encpos + = len ; //number of bytes consumed
2017-06-21 01:24:25 +00:00
s_voip . encsequence + + ; //increment number of packets, for packetloss detection.
samps + = len / 2 ; //number of samplepairs eaten in this packet. for stats.
break ;
case VOIP_PCMA :
case VOIP_PCMU :
2017-11-14 14:37:04 +00:00
//FIXME: what's with this /2? these are just 8-bit mono (logarithmic) pcm...
2017-06-21 01:24:25 +00:00
len = s_voip . capturepos - encpos ; //amount of data to be eaten in this frame
len = min ( len , sizeof ( outbuf ) - outpos ) ;
len = min ( len , s_voip . encframesize * 2 ) ;
level + = S_Voip_Preprocess ( start , len / 2 , micamp ) ;
if ( s_voip . enccodec = = VOIP_PCMA )
outpos + = PCMA_Encode ( outbuf + outpos , sizeof ( outbuf ) - outpos , start , len / 2 ) ;
else
outpos + = PCMU_Encode ( outbuf + outpos , sizeof ( outbuf ) - outpos , start , len / 2 ) ;
encpos + = len ; //number of bytes consumed
2013-07-26 17:19:06 +00:00
s_voip . encsequence + + ; //increment number of packets, for packetloss detection.
samps + = len / 2 ; //number of samplepairs eaten in this packet. for stats.
break ;
2019-04-16 22:40:05 +00:00
# ifdef HAVE_OPUS
2013-05-31 01:16:07 +00:00
case VOIP_OPUS :
2013-07-26 17:19:06 +00:00
{
//opus rtp only supports/allows a single chunk in each packet.
int frames ;
2016-01-18 05:22:07 +00:00
int nrate ;
2013-07-26 17:19:06 +00:00
//densely pack the frames.
start = ( short * ) ( s_voip . capturebuf + encpos ) ;
frames = ( s_voip . capturepos - encpos ) / 2 ;
2016-01-18 05:22:07 +00:00
2018-01-22 19:18:04 +00:00
nrate = snd_voip_bitrate . value ;
2016-01-18 05:22:07 +00:00
if ( nrate ! = s_voip . curbitrate )
{
s_voip . curbitrate = nrate ;
if ( nrate = = 0 )
nrate = - 1000 ;
qopus_encoder_ctl ( s_voip . encoder , OPUS_SET_BITRATE_REQUEST , ( int ) nrate ) ;
2017-01-17 19:04:09 +00:00
nrate = 10000 ;
2016-01-18 05:22:07 +00:00
}
2017-01-17 19:04:09 +00:00
if ( frames > = 2880 )
frames = 2880 ;
else if ( frames > = 1920 & & nrate > 100 )
frames = 1920 ;
else if ( frames > = 960 & & nrate > 500 )
frames = 960 ;
else if ( frames > = 480 & & nrate > 1000 )
frames = 480 ;
else if ( snd_voip_send . ival & 4 )
break ; //don't send small rtp packets, its abusive.
else if ( frames > = 240 & & nrate > 2000 )
frames = 240 ;
else if ( frames > = 120 & & nrate > 4000 )
frames = 120 ;
else
break ; //invalid size, wait for more.
2013-07-26 17:19:06 +00:00
level + = S_Voip_Preprocess ( start , frames , micamp ) ;
len = qopus_encode ( s_voip . encoder , start , frames , outbuf + outpos , sizeof ( outbuf ) - outpos ) ;
if ( len > = 0 )
{
s_voip . encsequence + = frames / s_voip . encframesize ;
outpos + = len ;
samps + = frames ;
encpos + = frames * 2 ;
}
else
{
Con_Printf ( " Opus encoding error: %i \n " , len ) ;
encpos = s_voip . capturepos ;
}
}
break ;
2019-04-16 22:40:05 +00:00
# endif
2013-05-31 01:16:07 +00:00
default :
outbuf [ outpos ] = 0 ;
break ;
}
2013-06-29 16:01:07 +00:00
2017-11-14 14:37:04 +00:00
//opus has no way to detect the end properly.
//standard rtp favours many small packets.
2013-07-26 17:19:06 +00:00
if ( rtpstream | | s_voip . enccodec = = VOIP_OPUS )
2013-06-29 16:01:07 +00:00
break ;
2010-11-20 22:01:16 +00:00
}
if ( samps )
{
float nl ;
2013-07-26 17:19:06 +00:00
s_voip . enctimestamp + = samps ;
2010-11-20 22:01:16 +00:00
nl = ( 3000 * level ) / ( 32767.0f * 32767 * samps ) ;
2013-05-31 01:16:07 +00:00
s_voip . voiplevel = ( s_voip . voiplevel * 7 + nl ) / 8 ;
2013-09-06 22:57:44 +00:00
if ( s_voip . voiplevel < snd_voip_vad_threshhold . ival & & ! voipbutton & & ! ( snd_voip_send . ival & 6 ) )
2010-11-20 22:01:16 +00:00
{
/*try and dump it, it was too quiet, and they're not pressing +voip*/
2013-05-31 01:16:07 +00:00
if ( s_voip . keeps > samps )
2010-11-20 22:01:16 +00:00
{
/*but not instantly*/
2013-05-31 01:16:07 +00:00
s_voip . keeps - = samps ;
2010-11-20 22:01:16 +00:00
}
else
{
outpos = 0 ;
2013-05-31 01:16:07 +00:00
s_voip . dumps + = samps ;
s_voip . keeps = 0 ;
2010-11-20 22:01:16 +00:00
}
}
2010-11-24 02:54:28 +00:00
else
2013-09-06 22:57:44 +00:00
s_voip . keeps = s_voip . encsamplerate * snd_voip_vad_delay . value ;
2010-11-20 22:01:16 +00:00
if ( outpos )
{
2013-05-31 01:16:07 +00:00
if ( s_voip . dumps > s_voip . encsamplerate / 4 )
s_voip . generation + + ;
s_voip . dumps = 0 ;
2010-11-20 22:01:16 +00:00
}
2010-11-15 02:40:31 +00:00
}
2017-01-17 19:04:09 +00:00
if ( outpos )
2010-11-15 02:40:31 +00:00
{
2017-01-17 19:04:09 +00:00
if ( buf & & ! ( snd_voip_send . ival & 4 ) )
2013-05-31 01:16:07 +00:00
{
2017-01-17 19:04:09 +00:00
if ( buf - > maxsize - buf - > cursize > = 5 + outpos )
{
2017-11-14 14:37:04 +00:00
qbyte cgen = ( ( s_voip . enccodec & 0x7 ) < < 4 ) | ( s_voip . generation & 0x0f ) ;
if ( s_voip . enccodec > = 8 | | 0 )
cgen | = 0x80 ;
2017-01-17 19:04:09 +00:00
MSG_WriteByte ( buf , clc ) ;
2017-11-14 14:37:04 +00:00
MSG_WriteByte ( buf , cgen ) ;
2017-01-17 19:04:09 +00:00
MSG_WriteByte ( buf , initseq & 0xff ) ;
2017-11-14 14:37:04 +00:00
/*if (cgen & 0x80)
{
MSG_WriteShort ( buf , 1 + outpos ) ;
MSG_WriteByte ( buf , s_voip . enccodec > > 3 ) ;
}
else */
MSG_WriteShort ( buf , outpos ) ; //even with codecs where the size is easy to determine, this is still useful for servers (which are unaware of the actual codec)
2017-01-17 19:04:09 +00:00
SZ_Write ( buf , outbuf , outpos ) ;
}
else
Con_Printf ( " Audio frame too small %i vs %i \n " , outpos + 4 , buf - > maxsize - buf - > cursize ) ;
2013-05-31 01:16:07 +00:00
}
2013-08-06 10:48:51 +00:00
# ifdef SUPPORT_ICE
2013-11-21 23:02:28 +00:00
if ( rtpstream )
2013-06-29 16:01:07 +00:00
{
2013-11-21 23:02:28 +00:00
switch ( s_voip . enccodec )
{
2019-04-16 22:40:05 +00:00
# ifdef HAVE_SPEEX
2013-11-21 23:02:28 +00:00
case VOIP_SPEEX_NARROW :
case VOIP_SPEEX_WIDE :
case VOIP_SPEEX_ULTRAWIDE :
case VOIP_SPEEX_OLD :
NET_RTP_Transmit ( initseq , inittimestamp , va ( " speex@%i " , s_voip . encsamplerate ) , outbuf , outpos ) ;
break ;
2019-04-16 22:40:05 +00:00
# endif
2017-06-21 01:24:25 +00:00
case VOIP_PCMA :
NET_RTP_Transmit ( initseq , inittimestamp , " pcma@8000 " , outbuf , outpos ) ;
break ;
case VOIP_PCMU :
NET_RTP_Transmit ( initseq , inittimestamp , " pcmu@8000 " , outbuf , outpos ) ;
break ;
2019-04-16 22:40:05 +00:00
# ifdef HAVE_OPUS
2013-11-21 23:02:28 +00:00
case VOIP_OPUS :
2017-06-21 01:24:25 +00:00
NET_RTP_Transmit ( initseq , inittimestamp , " opus@48000 " , outbuf , outpos ) ;
2013-11-21 23:02:28 +00:00
break ;
2019-04-16 22:40:05 +00:00
# endif
2013-11-21 23:02:28 +00:00
}
2013-06-29 16:01:07 +00:00
}
2013-08-06 10:48:51 +00:00
# endif
2013-06-29 16:01:07 +00:00
2013-09-06 22:57:44 +00:00
if ( snd_voip_test . ival )
2016-07-12 00:40:13 +00:00
S_Voip_Decode ( cl . playerview [ 0 ] . playernum , s_voip . enccodec , s_voip . generation & 0x0f , initseq & 0xff , outpos , outbuf ) ;
2013-05-31 01:16:07 +00:00
//update our own lastspoke, so queries shows that we're speaking when we're speaking in a generic way, even if we can't hear ourselves.
//but don't update general lastspoke, so ducking applies only when others speak. use capturingvol for yourself. they're more explicit that way.
2013-06-23 02:17:02 +00:00
s_voip . lastspoke [ cl . playerview [ 0 ] . playernum ] = realtime + 0.5 ;
2010-11-15 02:40:31 +00:00
}
/*remove sent data*/
2013-05-31 01:16:07 +00:00
if ( encpos )
{
memmove ( s_voip . capturebuf , s_voip . capturebuf + encpos , s_voip . capturepos - encpos ) ;
s_voip . capturepos - = encpos ;
}
2005-08-03 23:14:59 +00:00
}
2010-12-05 02:54:13 +00:00
void S_Voip_Ignore ( unsigned int slot , qboolean ignore )
2010-12-05 02:46:07 +00:00
{
CL_SendClientCommand ( true , " vignore %i %i " , slot , ignore ) ;
}
2010-11-16 02:03:47 +00:00
static void S_Voip_Enable_f ( void )
2010-11-15 03:37:29 +00:00
{
2021-08-04 21:18:04 +00:00
if ( Cmd_IsInsecure ( ) )
return ;
2013-09-06 22:57:44 +00:00
voipbutton = true ;
2010-11-15 03:37:29 +00:00
}
2010-11-16 02:03:47 +00:00
static void S_Voip_Disable_f ( void )
2010-11-15 03:37:29 +00:00
{
2013-09-06 22:57:44 +00:00
voipbutton = false ;
2010-11-15 03:37:29 +00:00
}
2010-11-16 02:03:47 +00:00
static void S_Voip_f ( void )
{
2019-04-17 00:50:14 +00:00
# ifdef HAVE_SPEEX
2010-11-20 22:01:16 +00:00
if ( ! strcmp ( Cmd_Argv ( 1 ) , " maxgain " ) )
{
2019-04-17 00:50:14 +00:00
int i = atoi ( Cmd_Argv ( 2 ) ) ;
2013-05-31 01:16:07 +00:00
if ( s_voip . speexdsp . preproc )
qspeex_preprocess_ctl ( s_voip . speexdsp . preproc , SPEEX_PREPROCESS_SET_AGC_MAX_GAIN , & i ) ;
2010-11-20 22:01:16 +00:00
}
2019-04-17 00:50:14 +00:00
else
# endif
{
Con_Printf ( " unrecognised parameter \" %s \" \n " , Cmd_Argv ( 1 ) ) ;
}
2010-11-16 02:03:47 +00:00
}
2015-04-21 04:12:00 +00:00
static void QDECL S_Voip_Play_Callback ( cvar_t * var , char * oldval )
2010-11-16 02:03:47 +00:00
{
if ( cls . fteprotocolextensions2 & PEXT2_VOICECHAT )
{
2013-05-31 01:16:07 +00:00
if ( var - > value > 0 )
2010-11-16 02:03:47 +00:00
CL_SendClientCommand ( true , " unmuteall " ) ;
else
CL_SendClientCommand ( true , " muteall " ) ;
}
}
void S_Voip_MapChange ( void )
{
2017-01-17 19:04:09 +00:00
voipbutton = false ;
2013-09-06 22:57:44 +00:00
Cvar_ForceCallback ( & snd_voip_play ) ;
2010-11-16 02:03:47 +00:00
}
2010-11-20 22:01:16 +00:00
int S_Voip_Loudness ( qboolean ignorevad )
{
2013-05-31 01:16:07 +00:00
if ( s_voip . voiplevel > 100 )
2010-11-20 22:01:16 +00:00
return 100 ;
2013-05-31 01:16:07 +00:00
if ( ! s_voip . cdriverctx | | ( ! ignorevad & & s_voip . dumps ) )
2010-11-20 22:01:16 +00:00
return - 1 ;
2013-05-31 01:16:07 +00:00
return s_voip . voiplevel ;
2010-11-20 22:01:16 +00:00
}
2018-11-22 03:02:36 +00:00
int S_Voip_ClientLoudness ( unsigned int plno )
{
if ( plno > = MAX_CLIENTS )
return 0 ;
if ( s_voip . lastspoke [ plno ] > realtime )
return s_voip . declevel [ plno ] ;
return - 1 ;
}
2010-11-20 22:01:16 +00:00
qboolean S_Voip_Speaking ( unsigned int plno )
{
if ( plno > = MAX_CLIENTS )
return false ;
2013-05-31 01:16:07 +00:00
return s_voip . lastspoke [ plno ] > realtime ;
}
void S_Voip_Init ( void )
{
int i ;
for ( i = 0 ; i < MAX_CLIENTS ; i + + )
s_voip . deccodec [ i ] = VOIP_INVALID ;
s_voip . enccodec = VOIP_INVALID ;
2013-09-06 22:57:44 +00:00
Cvar_Register ( & snd_voip_capturedevice , " Voice Chat " ) ;
Cvar_Register ( & snd_voip_capturedevice_opts , " Voice Chat " ) ;
Cvar_Register ( & snd_voip_send , " Voice Chat " ) ;
Cvar_Register ( & snd_voip_vad_threshhold , " Voice Chat " ) ;
Cvar_Register ( & snd_voip_vad_delay , " Voice Chat " ) ;
Cvar_Register ( & snd_voip_capturingvol , " Voice Chat " ) ;
Cvar_Register ( & snd_voip_showmeter , " Voice Chat " ) ;
Cvar_Register ( & snd_voip_play , " Voice Chat " ) ;
Cvar_Register ( & snd_voip_test , " Voice Chat " ) ;
Cvar_Register ( & snd_voip_ducking , " Voice Chat " ) ;
Cvar_Register ( & snd_voip_micamp , " Voice Chat " ) ;
Cvar_Register ( & snd_voip_codec , " Voice Chat " ) ;
2019-04-17 00:50:14 +00:00
# ifdef HAVE_SPEEX
2013-09-06 22:57:44 +00:00
Cvar_Register ( & snd_voip_noisefilter , " Voice Chat " ) ;
Cvar_Register ( & snd_voip_autogain , " Voice Chat " ) ;
2019-04-17 00:50:14 +00:00
# endif
2018-01-22 19:18:04 +00:00
Cvar_Register ( & snd_voip_bitrate , " Voice Chat " ) ;
2013-05-31 01:16:07 +00:00
Cmd_AddCommand ( " +voip " , S_Voip_Enable_f ) ;
Cmd_AddCommand ( " -voip " , S_Voip_Disable_f ) ;
Cmd_AddCommand ( " voip " , S_Voip_f ) ;
2010-11-20 22:01:16 +00:00
}
2011-09-05 01:48:23 +00:00
# else
void S_Voip_Parse ( void )
{
unsigned int bytes ;
MSG_ReadByte ( ) ;
MSG_ReadByte ( ) ;
MSG_ReadByte ( ) ;
bytes = MSG_ReadShort ( ) ;
MSG_ReadSkip ( bytes ) ;
}
2010-11-15 02:40:31 +00:00
# endif
2005-08-03 23:14:59 +00:00
2004-08-23 00:15:46 +00:00
2013-07-26 17:19:06 +00:00
void S_DefaultSpeakerConfiguration ( soundcardinfo_t * sc )
{
sc - > dist [ 0 ] = 1 ;
sc - > dist [ 1 ] = 1 ;
sc - > dist [ 2 ] = 1 ;
sc - > dist [ 3 ] = 1 ;
sc - > dist [ 4 ] = 1 ;
sc - > dist [ 5 ] = 1 ;
switch ( sc - > sn . numchannels )
{
case 1 :
VectorSet ( sc - > speakerdir [ 0 ] , 0 , 0 , 0 ) ;
break ;
case 2 :
case 3 :
VectorSet ( sc - > speakerdir [ 0 ] , 0 , - 1 , 0 ) ;
VectorSet ( sc - > speakerdir [ 1 ] , 0 , 1 , 0 ) ;
VectorSet ( sc - > speakerdir [ 2 ] , 0 , 0 , 0 ) ;
break ;
case 4 : // quad
case 5 :
VectorSet ( sc - > speakerdir [ 0 ] , 0.7 , - 0.7 , 0 ) ;
VectorSet ( sc - > speakerdir [ 1 ] , 0.7 , 0.7 , 0 ) ;
VectorSet ( sc - > speakerdir [ 2 ] , - 0.7 , - 0.7 , 0 ) ;
VectorSet ( sc - > speakerdir [ 3 ] , - 0.7 , 0.7 , 0 ) ;
VectorSet ( sc - > speakerdir [ 4 ] , 0 , 0 , 0 ) ;
break ;
case 6 : // 5.1
case 7 :
2016-07-12 00:40:13 +00:00
VectorSet ( sc - > speakerdir [ 0 ] , 0.7 , - 0.7 , 0 ) ; //front-left
VectorSet ( sc - > speakerdir [ 1 ] , 0.7 , 0.7 , 0 ) ; //front-right
VectorSet ( sc - > speakerdir [ 2 ] , 1 , 0 , 0 ) ; //center
VectorSet ( sc - > speakerdir [ 3 ] , 0 , 0 , 0 ) ; //bass
VectorSet ( sc - > speakerdir [ 4 ] , - 0.7 , - 0.7 , 0 ) ; //back-left
VectorSet ( sc - > speakerdir [ 5 ] , - 0.7 , 0.7 , 0 ) ; //back-right
2013-07-26 17:19:06 +00:00
VectorSet ( sc - > speakerdir [ 6 ] , 0 , 0 , 0 ) ;
break ;
case 8 : // 7.1
default :
VectorSet ( sc - > speakerdir [ 0 ] , 0.7 , - 0.7 , 0 ) ;
VectorSet ( sc - > speakerdir [ 1 ] , 0.7 , 0.7 , 0 ) ;
VectorSet ( sc - > speakerdir [ 2 ] , 1 , 0 , 0 ) ;
VectorSet ( sc - > speakerdir [ 3 ] , 0 , 0 , 0 ) ;
VectorSet ( sc - > speakerdir [ 4 ] , - 0.7 , - 0.7 , 0 ) ;
VectorSet ( sc - > speakerdir [ 5 ] , - 0.7 , 0.7 , 0 ) ;
VectorSet ( sc - > speakerdir [ 6 ] , 0 , - 1 , 0 ) ;
VectorSet ( sc - > speakerdir [ 7 ] , 0 , 1 , 0 ) ;
break ;
}
}
2016-07-12 00:40:13 +00:00
# ifdef AVAIL_WASAPI
extern sounddriver_t WASAPI_Output ;
# endif
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
# ifdef AVAIL_XAUDIO2
extern sounddriver_t XAUDIO2_Output ;
# endif
# ifdef AVAIL_DSOUND
extern sounddriver_t DSOUND_Output ;
# endif
2020-07-01 05:32:21 +00:00
sounddriver_t fte_weakstruct SDL_Output ;
2017-05-19 03:32:02 +00:00
# ifdef __linux__
2020-07-01 05:32:21 +00:00
extern sounddriver_t ALSA_Output ;
extern sounddriver_t Pulse_Output ;
2017-05-19 03:32:02 +00:00
# endif
2020-07-01 05:32:21 +00:00
sounddriver_t fte_weakstruct OSS_Output ;
2013-11-22 01:54:26 +00:00
# ifdef AVAIL_OPENAL
extern sounddriver_t OPENAL_Output ;
2021-10-22 22:27:21 +00:00
extern sounddriver_t OPENAL_Output_Lame ;
2013-11-22 01:54:26 +00:00
# endif
2017-05-19 03:32:02 +00:00
# ifdef __DJGPP__
extern sounddriver_t SBLASTER_Output ;
# endif
2017-09-20 11:27:13 +00:00
# if defined(_WIN32) && !defined(WINRT) && !defined(FTE_SDL)
extern sounddriver_t WaveOut_Output ;
# endif
2013-07-26 17:19:06 +00:00
2017-09-20 11:27:13 +00:00
# ifdef MACOSX
2020-07-01 05:32:21 +00:00
sounddriver_t fte_weakstruct MacOS_AudioOutput ; //prefered on mac
2017-09-20 11:27:13 +00:00
# endif
# ifdef ANDROID
2020-07-01 05:32:21 +00:00
sounddriver_t fte_weakstruct OSL_Output ; //general audio library, but android has all kinds of quirks.
sounddriver_t fte_weakstruct Droid_AudioOutput ;
2017-09-20 11:27:13 +00:00
# endif
# if defined(__MORPHOS__)
2020-07-01 05:32:21 +00:00
sounddriver_t fte_weakstruct AHI_AudioOutput ; //prefered on morphos
2017-09-20 11:27:13 +00:00
# endif
2013-03-12 23:09:25 +00:00
# ifdef NACL
2017-09-20 11:27:13 +00:00
extern sounddriver_t PPAPI_AudioOutput ; //nacl
2013-03-12 23:09:25 +00:00
# endif
2020-07-01 05:32:21 +00:00
sounddriver_t fte_weakstruct SNDIO_AudioOutput ; //bsd
2005-11-26 03:02:55 +00:00
2013-07-26 17:19:06 +00:00
//in order of preference
2016-07-12 00:40:13 +00:00
static sounddriver_t * outputdrivers [ ] =
2013-07-26 17:19:06 +00:00
{
2013-11-22 01:54:26 +00:00
# ifdef AVAIL_OPENAL
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
& OPENAL_Output , //refuses to run as the default device, at least until its perfected.
2013-11-22 01:54:26 +00:00
# endif
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
2017-05-23 07:03:07 +00:00
# ifdef HAVE_MIXER
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
# ifdef AVAIL_DSOUND
2013-07-26 17:19:06 +00:00
& DSOUND_Output ,
2015-05-14 03:06:58 +00:00
# endif
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
# ifdef AVAIL_XAUDIO2
& XAUDIO2_Output ,
# endif
2016-07-12 00:40:13 +00:00
# ifdef AVAIL_WASAPI
& WASAPI_Output , //this is last, so that we can default to exclusive. woot.
# endif
2015-05-14 03:06:58 +00:00
2019-01-13 16:51:50 +00:00
& SDL_Output , //prefered on linux. distros can ensure that its configured correctly.
2020-07-14 00:48:56 +00:00
# ifdef AUDIO_PULSE
2019-01-13 16:51:50 +00:00
& Pulse_Output , //wasteful, and availability generally means Alsa is broken/defective.
2020-07-14 00:48:56 +00:00
# endif
# ifdef AUDIO_ALSA
2019-01-13 16:51:50 +00:00
& ALSA_Output , //pure shite, and availability generally means OSS is broken/defective.
2015-05-14 03:06:58 +00:00
# endif
2020-07-14 00:48:56 +00:00
# ifdef AUDIO_OSS
2019-01-13 16:51:50 +00:00
& OSS_Output , //good for low latency audio, but not likely to work any more on linux (unlike every other unix system with a decent opengl driver)
2020-07-14 00:48:56 +00:00
# endif
2017-05-19 03:32:02 +00:00
# ifdef __DJGPP__
& SBLASTER_Output , //zomgwtfdos?
2017-05-23 07:03:07 +00:00
# endif
2017-09-20 11:27:13 +00:00
# if defined(_WIN32) && !defined(WINRT) && !defined(FTE_SDL)
& WaveOut_Output , //doesn't work properly in vista, etc.
# endif
# ifdef MACOSX
& MacOS_AudioOutput , //prefered on mac
# endif
# ifdef ANDROID
2019-04-15 18:43:42 +00:00
& OSL_Output , //opensl(es)
2017-09-20 11:27:13 +00:00
# endif
# if defined(__MORPHOS__)
& AHI_AudioOutput , //prefered on morphos
2017-05-19 03:32:02 +00:00
# endif
2013-03-12 23:09:25 +00:00
# ifdef NACL
2017-09-20 11:27:13 +00:00
& PPAPI_AudioOutput , //google's native client
2013-03-12 23:09:25 +00:00
# endif
2017-09-20 11:27:13 +00:00
& SNDIO_AudioOutput , //prefered on OpenBSD
2010-03-14 14:35:56 +00:00
2021-10-22 22:27:21 +00:00
# ifdef AVAIL_OPENAL
& OPENAL_Output_Lame , //streaming quake's audio via openal instead of using openal properly. used in our browser port to work around issues with webaudio (at least in chromium).
# endif
2017-05-23 07:03:07 +00:00
# endif
2017-09-20 11:27:13 +00:00
NULL
2005-06-14 04:52:10 +00:00
} ;
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 soundcardinfo_t * SNDDMA_Init ( char * driver , char * device , int seat )
2005-06-14 04:52:10 +00:00
{
2013-07-26 17:19:06 +00:00
soundcardinfo_t * sc = Z_Malloc ( sizeof ( soundcardinfo_t ) ) ;
sounddriver_t * sd ;
int i ;
int st ;
2005-06-14 04:52:10 +00:00
memset ( sc , 0 , sizeof ( * sc ) ) ;
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
sc - > seat = seat ;
2006-05-10 05:18:08 +00:00
2016-02-10 23:23:43 +00:00
sc - > next = sndcardinfo ;
sndcardinfo = sc ;
2006-05-10 05:18:08 +00:00
// set requested rate
2011-09-03 03:49:43 +00:00
if ( snd_khz . ival > = 1000 )
sc - > sn . speed = snd_khz . ival ;
else if ( snd_khz . ival < = 0 )
2006-05-09 20:43:39 +00:00
sc - > sn . speed = 22050 ;
2009-11-04 21:16:50 +00:00
/* else if (snd_khz.ival >= 195)
2006-05-09 20:43:39 +00:00
sc - > sn . speed = 200000 ;
2009-11-04 21:16:50 +00:00
else if ( snd_khz . ival > = 180 )
2006-05-09 20:43:39 +00:00
sc - > sn . speed = 192000 ;
2009-11-04 21:16:50 +00:00
else if ( snd_khz . ival > = 90 )
2006-05-09 20:43:39 +00:00
sc - > sn . speed = 96000 ; */
2009-11-04 21:16:50 +00:00
else if ( snd_khz . ival > = 45 )
2005-06-14 04:52:10 +00:00
sc - > sn . speed = 48000 ;
2009-11-04 21:16:50 +00:00
else if ( snd_khz . ival > = 30 )
2005-06-14 04:52:10 +00:00
sc - > sn . speed = 44100 ;
2009-11-04 21:16:50 +00:00
else if ( snd_khz . ival > = 20 )
2005-06-14 04:52:10 +00:00
sc - > sn . speed = 22050 ;
2009-11-04 21:16:50 +00:00
else if ( snd_khz . ival > = 10 )
2005-06-14 04:52:10 +00:00
sc - > sn . speed = 11025 ;
2006-05-09 20:43:39 +00:00
else
sc - > sn . speed = 8000 ;
2005-06-14 04:52:10 +00:00
2006-05-10 05:18:08 +00:00
// set requested speaker count
2009-11-04 21:16:50 +00:00
if ( snd_speakers . ival > MAXSOUNDCHANNELS )
2006-05-10 07:35:19 +00:00
sc - > sn . numchannels = MAXSOUNDCHANNELS ;
2009-11-04 21:16:50 +00:00
else if ( snd_speakers . ival > 1 )
sc - > sn . numchannels = ( int ) snd_speakers . ival ;
2006-05-10 05:18:08 +00:00
else
sc - > sn . numchannels = 1 ;
// set requested sample bits
2017-09-20 11:27:13 +00:00
if ( snd_samplebits . ival > = 32 )
sc - > sn . samplebytes = 4 ;
else if ( snd_samplebits . ival > = 16 )
sc - > sn . samplebytes = 2 ;
2006-05-10 05:18:08 +00:00
else
2017-09-20 11:27:13 +00:00
sc - > sn . samplebytes = 1 ;
2006-05-10 05:18:08 +00:00
// set requested buffer size
2009-11-04 21:16:50 +00:00
if ( snd_buffersize . ival > 0 )
sc - > sn . samples = snd_buffersize . ival * sc - > sn . numchannels ;
2006-05-10 05:18:08 +00:00
else
sc - > sn . samples = 0 ;
2013-07-26 17:19:06 +00:00
for ( i = 0 ; outputdrivers [ i ] ; i + + )
2011-01-29 19:53:38 +00:00
{
2013-07-26 17:19:06 +00:00
sd = outputdrivers [ i ] ;
2015-05-14 03:06:58 +00:00
if ( sd & & sd - > name & & ( ! driver | | ! Q_strcasecmp ( sd - > name , driver ) ) )
2013-07-26 17:19:06 +00:00
{
//skip drivers which are not present.
if ( ! sd - > InitCard )
continue ;
2005-11-26 03:02:55 +00:00
2013-07-26 17:19:06 +00:00
st = ( * * sd - > InitCard ) ( sc , device ) ;
if ( st )
{
2017-09-20 11:27:13 +00:00
if ( ! sc - > sn . sampleformat )
{
Con_TPrintf ( " S_Startup: Ignoring soundcard %s due to unspecified sample format. \n " , sc - > name ) ;
S_ShutdownCard ( sc ) ;
continue ;
}
2013-07-26 17:19:06 +00:00
S_DefaultSpeakerConfiguration ( sc ) ;
2016-02-10 23:23:43 +00:00
if ( snd_speed )
2013-07-26 17:19:06 +00:00
{ //if the sample speeds of multiple soundcards do not match, it'll fail.
if ( snd_speed ! = sc - > sn . speed )
{
2013-12-29 22:48:28 +00:00
Con_TPrintf ( " S_Startup: Ignoring soundcard %s due to mismatched sample speeds. \n " , sc - > name ) ;
2013-07-26 17:19:06 +00:00
S_ShutdownCard ( sc ) ;
2017-09-20 11:27:13 +00:00
return NULL ;
2013-07-26 17:19:06 +00:00
}
}
else
snd_speed = sc - > sn . speed ;
2016-02-10 23:23:43 +00:00
if ( sc - > seat = = - 1 & & sc - > ListenerUpdate )
sc - > seat = 0 ; //hardware rendering won't cope with seat=-1
2017-04-10 07:52:18 +00:00
2021-11-14 00:34:59 +00:00
Z_ReallocElements ( ( void * * ) & sc - > channel , & sc - > max_chans , NUM_AMBIENTS + NUM_MUSICS , sizeof ( * sc - > channel ) ) ;
2013-07-26 17:19:06 +00:00
return sc ;
}
}
2005-06-14 04:52:10 +00:00
}
2013-07-26 17:19:06 +00:00
2016-02-10 23:23:43 +00:00
S_ShutdownCard ( sc ) ;
2013-12-29 22:48:28 +00:00
if ( ! driver )
Con_TPrintf ( " Could not start audio device \" %s \" \n " , device ? device : " default " ) ;
else
Con_TPrintf ( " Could not start \" %s \" device \" %s \" \n " , driver , device ? device : " default " ) ;
2013-07-26 17:19:06 +00:00
return NULL ;
2005-06-14 04:52:10 +00:00
}
2016-02-10 23:23:43 +00:00
soundcardinfo_t * S_SetupDeviceSeat ( char * driver , char * device , int seat )
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
{
2016-02-10 23:23:43 +00:00
return SNDDMA_Init ( driver , device , seat ) ;
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
/*
soundcardinfo_t * sc ;
for ( sc = sndcardinfo ; sc ; sc = sc - > next )
{
sc - > seat = seat ;
} */
}
2016-07-12 00:40:13 +00:00
static void QDECL S_EnumeratedOutDevice ( const char * driver , const char * devicecode , const char * readabledevice )
2006-09-17 00:59:22 +00:00
{
2013-07-26 17:19:06 +00:00
const char * fullintname ;
2013-09-06 22:57:44 +00:00
char opts [ 8192 ] ;
char nbuf [ 1024 ] ;
char dbuf [ 1024 ] ;
2013-07-26 17:19:06 +00:00
2018-06-02 08:55:57 +00:00
if ( devicecode )
2013-07-26 17:19:06 +00:00
fullintname = va ( " %s:%s " , driver , devicecode ) ;
else
fullintname = driver ;
2010-11-06 23:05:29 +00:00
2015-01-02 05:20:56 +00:00
Q_snprintfz ( opts , sizeof ( opts ) , " %s%s%s %s " , snd_device_opts . string , * snd_device_opts . string ? " " : " " , COM_QuotedString ( fullintname , nbuf , sizeof ( nbuf ) , false ) , COM_QuotedString ( readabledevice , dbuf , sizeof ( dbuf ) , false ) ) ;
2013-09-06 22:57:44 +00:00
Cvar_ForceSet ( & snd_device_opts , opts ) ;
2013-07-26 17:19:06 +00:00
}
2016-07-12 00:40:13 +00:00
# ifdef VOICECHAT
static void QDECL S_Voip_EnumeratedCaptureDevice ( const char * driver , const char * devicecode , const char * readabledevice )
{
const char * fullintname ;
char opts [ 8192 ] ;
char nbuf [ 1024 ] ;
char dbuf [ 1024 ] ;
2019-05-10 09:31:21 +00:00
if ( devicecode )
2016-07-12 00:40:13 +00:00
fullintname = va ( " %s:%s " , driver , devicecode ) ;
else
fullintname = driver ;
2017-01-24 10:27:39 +00:00
2016-07-12 00:40:13 +00:00
Q_snprintfz ( opts , sizeof ( opts ) , " %s%s%s %s " , snd_voip_capturedevice_opts . string , * snd_voip_capturedevice_opts . string ? " " : " " , COM_QuotedString ( fullintname , nbuf , sizeof ( nbuf ) , false ) , COM_QuotedString ( readabledevice , dbuf , sizeof ( dbuf ) , false ) ) ;
Cvar_ForceSet ( & snd_voip_capturedevice_opts , opts ) ;
}
# endif
2013-07-26 17:19:06 +00:00
void S_EnumerateDevices ( void )
{
int i ;
sounddriver_t * sd ;
2021-07-01 01:15:52 +00:00
qboolean safe = COM_CheckParm ( " -noenumerate " ) | | COM_CheckParm ( " -safe " ) ;
2013-09-06 22:57:44 +00:00
Cvar_ForceSet ( & snd_device_opts , " " ) ;
2013-07-26 17:19:06 +00:00
S_EnumeratedOutDevice ( " " , NULL , " Default " ) ;
2016-07-12 00:40:13 +00:00
S_EnumeratedOutDevice ( " none " , NULL , " None " ) ;
2013-07-26 17:19:06 +00:00
for ( i = 0 ; outputdrivers [ i ] ; i + + )
2006-09-17 00:59:22 +00:00
{
2013-07-26 17:19:06 +00:00
sd = outputdrivers [ i ] ;
if ( sd & & sd - > name )
{
2021-07-01 01:15:52 +00:00
if ( safe | | ! sd - > Enumerate | | ! sd - > Enumerate ( S_EnumeratedOutDevice ) )
2013-07-26 17:19:06 +00:00
S_EnumeratedOutDevice ( sd - > name , " " , va ( " Default %s " , sd - > name ) ) ;
}
2006-09-17 00:59:22 +00:00
}
2016-07-12 00:40:13 +00:00
# ifdef VOICECHAT
Cvar_ForceSet ( & snd_voip_capturedevice_opts , " " ) ;
S_Voip_EnumeratedCaptureDevice ( " " , NULL , " Default " ) ;
for ( i = 0 ; capturedrivers [ i ] ; i + + )
{
if ( ! capturedrivers [ i ] - > Init )
continue ;
2021-07-01 01:15:52 +00:00
if ( safe | | ! capturedrivers [ i ] - > Enumerate | | ! capturedrivers [ i ] - > Enumerate ( S_Voip_EnumeratedCaptureDevice ) )
2016-07-12 00:40:13 +00:00
S_Voip_EnumeratedCaptureDevice ( capturedrivers [ i ] - > drivername , NULL , va ( " Default %s " , capturedrivers [ i ] - > drivername ) ) ;
}
# endif
2006-09-17 00:59:22 +00:00
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = =
S_Startup
= = = = = = = = = = = = = = = =
*/
2005-07-14 01:57:34 +00:00
void S_ClearRaw ( void ) ;
2004-08-23 00:15:46 +00:00
void S_Startup ( void )
{
2015-06-15 20:11:27 +00:00
qboolean nodefault = false ;
2013-07-26 17:19:06 +00:00
char * s ;
2004-08-23 00:15:46 +00:00
if ( ! snd_initialized )
return ;
if ( sound_started )
2013-08-21 07:14:39 +00:00
S_Shutdown ( false ) ;
2004-08-23 00:15:46 +00:00
2005-02-06 02:47:36 +00:00
snd_blocked = 0 ;
2006-06-02 17:42:36 +00:00
snd_speed = 0 ;
2005-02-06 02:47:36 +00:00
2016-07-12 00:40:13 +00:00
S_UpdateReverb ( 0 , NULL , 0 ) ;
{ //we can actually use underwater hints automatically easily enough. q3 also does this.
//its other things that are more awkward.
struct reverbproperties_s underwater = REVERB_PRESET_UNDERWATER ;
S_UpdateReverb ( 1 , & underwater , sizeof ( underwater ) ) ;
}
2013-07-26 17:19:06 +00:00
for ( s = snd_device . string ; ; )
2004-08-23 00:15:46 +00:00
{
2013-07-26 17:19:06 +00:00
char * sep ;
s = COM_Parse ( s ) ;
if ( ! * com_token )
2006-09-17 00:59:22 +00:00
break ;
2004-08-23 00:15:46 +00:00
2015-06-15 20:11:27 +00:00
if ( ! Q_strcasecmp ( com_token , " none " ) )
nodefault = true ;
else
{
sep = strchr ( com_token , ' : ' ) ;
if ( sep )
* sep + + = 0 ;
2016-01-18 05:22:07 +00:00
SNDDMA_Init ( com_token , sep , - 1 ) ;
2015-06-15 20:11:27 +00:00
}
2004-08-23 00:15:46 +00:00
}
2015-06-15 20:11:27 +00:00
if ( ! sndcardinfo & & ! nodefault )
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
{
2015-09-14 15:20:09 +00:00
# if defined(_WIN32) && !defined(FTE_SDL)
2016-02-10 23:23:43 +00:00
INS_SetupControllerAudioDevices ( 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
# endif
if ( ! sndcardinfo )
2016-01-18 05:22:07 +00:00
SNDDMA_Init ( NULL , NULL , - 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
}
2004-08-23 00:15:46 +00:00
2013-07-26 17:19:06 +00:00
sound_started = true ;
2005-07-14 01:57:34 +00:00
S_ClearRaw ( ) ;
2012-05-14 01:41:08 +00:00
2013-07-14 12:22:51 +00:00
if ( ! known_sfx )
known_sfx = Z_Malloc ( MAX_SFX * sizeof ( sfx_t ) ) ;
num_sfx = 0 ;
2012-05-14 01:41:08 +00:00
CL_InitTEntSounds ( ) ;
2013-03-12 22:53:23 +00:00
ambient_sfx [ AMBIENT_WATER ] = S_PrecacheSound ( " ambience/water1.wav " ) ;
ambient_sfx [ AMBIENT_SKY ] = S_PrecacheSound ( " ambience/wind2.wav " ) ;
2004-08-23 00:15:46 +00:00
}
2005-06-18 23:52:42 +00:00
//why isn't this part of S_Restart_f anymore?
//so that the video code can call it directly without flushing the models it's just loaded.
2015-12-28 17:41:39 +00:00
void S_DoRestart ( qboolean onlyifneeded )
2005-06-14 04:52:10 +00:00
{
2012-07-05 19:42:36 +00:00
int i ;
2015-12-28 17:41:39 +00:00
if ( onlyifneeded & & sound_started )
return ; //don't need to if its already running.
2012-07-05 19:42:36 +00:00
2012-02-27 12:23:15 +00:00
S_StopAllSounds ( true ) ;
2013-08-21 07:14:39 +00:00
S_Shutdown ( false ) ;
2012-02-27 12:23:15 +00:00
2009-11-04 21:16:50 +00:00
if ( nosound . ival )
2004-12-02 07:09:14 +00:00
return ;
2004-08-23 00:15:46 +00:00
S_Startup ( ) ;
S_StopAllSounds ( true ) ;
2012-07-05 19:42:36 +00:00
2014-09-17 03:04:08 +00:00
for ( i = 1 ; i < MAX_PRECACHE_SOUNDS ; i + + )
2012-07-05 19:42:36 +00:00
{
if ( ! cl . sound_name [ i ] [ 0 ] )
break ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
cl . sound_precache [ i ] = S_FindName ( cl . sound_name [ i ] , true , false ) ;
2012-07-05 19:42:36 +00:00
}
2004-08-23 00:15:46 +00:00
}
2005-06-18 23:52:42 +00:00
void S_Restart_f ( void )
{
2017-07-28 01:49:25 +00:00
S_EnumerateDevices ( ) ;
2015-12-28 17:41:39 +00:00
S_DoRestart ( false ) ;
2005-06-18 23:52:42 +00:00
}
2004-08-23 00:15:46 +00:00
void S_Control_f ( void )
2005-06-14 04:52:10 +00:00
{
2004-08-23 00:15:46 +00:00
int i ;
char * command ;
command = Cmd_Argv ( 1 ) ;
if ( ! Q_strcasecmp ( command , " off " ) )
{
Cache_Flush ( ) ; //forget the old sounds.
2005-06-14 04:52:10 +00:00
S_StopAllSounds ( true ) ;
2004-08-23 00:15:46 +00:00
2013-08-21 07:14:39 +00:00
S_Shutdown ( false ) ;
2004-08-23 00:15:46 +00:00
sound_started = 0 ;
}
if ( ! Q_strcasecmp ( command , " rate " ) | | ! Q_strcasecmp ( command , " speed " ) )
{
2005-06-14 04:52:10 +00:00
Cvar_SetValue ( & snd_khz , atof ( Cmd_Argv ( 2 ) ) / 1000 ) ;
2004-08-23 00:15:46 +00:00
S_Restart_f ( ) ;
return ;
}
//individual device control
if ( ! Q_strncasecmp ( command , " card " , 4 ) )
{
int card ;
soundcardinfo_t * sc ;
card = atoi ( command + 4 ) ;
2005-01-13 16:29:20 +00:00
for ( i = 0 , sc = sndcardinfo ; i < card & & sc ; i + + , sc = sc - > next )
;
2004-08-23 00:15:46 +00:00
if ( ! sc )
{
Con_Printf ( " Sound card %i is invalid (try resetting first) \n " , card ) ;
return ;
}
if ( Cmd_Argc ( ) < 3 )
{
Con_Printf ( " Scard %i is %s \n " , card , sc - > name ) ;
return ;
}
command = Cmd_Argv ( 2 ) ;
if ( ! Q_strcasecmp ( command , " mono " ) )
{
for ( i = 0 ; i < MAXSOUNDCHANNELS ; i + + )
{
2010-11-06 23:05:29 +00:00
VectorSet ( sc - > speakerdir [ i ] , 0 , 0 , 0 ) ;
2004-08-23 00:15:46 +00:00
sc - > dist [ i ] = 1 ;
}
}
else if ( ! Q_strcasecmp ( command , " standard " ) | | ! Q_strcasecmp ( command , " stereo " ) )
{
for ( i = 0 ; i < MAXSOUNDCHANNELS ; i + + )
{
2010-11-29 03:42:15 +00:00
VectorSet ( sc - > speakerdir [ i ] , 0 , ( i & 1 ) ? 1 : - 1 , 0 ) ;
2004-08-23 00:15:46 +00:00
sc - > dist [ i ] = 1 ;
}
}
else if ( ! Q_strcasecmp ( command , " swap " ) )
{
for ( i = 0 ; i < MAXSOUNDCHANNELS ; i + + )
{
2010-11-06 23:05:29 +00:00
sc - > speakerdir [ i ] [ 1 ] * = - 1 ;
2004-08-23 00:15:46 +00:00
}
}
else if ( ! Q_strcasecmp ( command , " front " ) )
{
for ( i = 0 ; i < MAXSOUNDCHANNELS ; i + + )
{
2010-11-06 23:05:29 +00:00
VectorSet ( sc - > speakerdir [ i ] , 0.7 , ( i & 1 ) ? - 0.7 : 0.7 , 0 ) ;
2004-08-23 00:15:46 +00:00
sc - > dist [ i ] = 1 ;
}
}
else if ( ! Q_strcasecmp ( command , " back " ) )
{
for ( i = 0 ; i < MAXSOUNDCHANNELS ; i + + )
{
2010-11-06 23:05:29 +00:00
VectorSet ( sc - > speakerdir [ i ] , - 0.7 , ( i & 1 ) ? - 0.7 : 0.7 , 0 ) ;
2004-08-23 00:15:46 +00:00
sc - > dist [ i ] = 1 ;
}
}
return ;
}
2010-11-06 23:05:29 +00:00
else
Con_Printf ( " valid commands are: off, single, multi, cardX mono, cardX stereo, cardX front, cardX back \n " ) ;
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = = = =
S_Init
= = = = = = = = = = = = = = = =
*/
void S_Init ( void )
{
2017-09-20 11:27:13 +00:00
int p , i ;
2004-08-23 00:15:46 +00:00
2005-05-08 06:03:15 +00:00
Con_DPrintf ( " \n Sound Initialization \n " ) ;
2004-08-23 00:15:46 +00:00
2019-02-20 17:21:10 +00:00
Cmd_AddCommand ( " play " , S_Play_f ) ; //sound that doesn't follow the player
Cmd_AddCommand ( " play2 " , S_Play_f ) ; //sound that DOES follow the player
Cmd_AddCommand ( " playvol " , S_Play_f ) ;
2012-02-27 12:23:15 +00:00
Cmd_AddCommand ( " stopsound " , S_StopAllSounds_f ) ;
Cmd_AddCommand ( " soundlist " , S_SoundList_f ) ;
2004-08-23 00:15:46 +00:00
Cmd_AddCommand ( " soundinfo " , S_SoundInfo_f ) ;
Cmd_AddCommand ( " snd_restart " , S_Restart_f ) ;
Cmd_AddCommand ( " soundcontrol " , S_Control_f ) ;
Cvar_Register ( & nosound , " Sound controls " ) ;
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
Cvar_Register ( & mastervolume , " Sound controls " ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & volume , " Sound controls " ) ;
2020-06-12 23:29:58 +00:00
Cvar_Register ( & snd_precache , " Sound controls " ) ;
2020-10-26 06:30:35 +00:00
Cvar_Register ( & snd_loadas8bit , " Sound controls " ) ;
2020-04-26 01:32:02 +00:00
Cvar_Register ( & snd_loadasstereo , " Sound controls " ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & bgmvolume , " Sound controls " ) ;
2019-07-19 02:13:19 +00:00
Cvar_Register ( & snd_nominaldistance , " Sound controls " ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & ambient_level , " Sound controls " ) ;
Cvar_Register ( & ambient_fade , " Sound controls " ) ;
Cvar_Register ( & snd_noextraupdate , " Sound controls " ) ;
Cvar_Register ( & snd_show , " Sound controls " ) ;
Cvar_Register ( & _snd_mixahead , " Sound controls " ) ;
Cvar_Register ( & snd_khz , " Sound controls " ) ;
Cvar_Register ( & snd_leftisright , " Sound controls " ) ;
Cvar_Register ( & snd_eax , " Sound controls " ) ;
Cvar_Register ( & snd_speakers , " Sound controls " ) ;
2006-05-10 05:18:08 +00:00
Cvar_Register ( & snd_buffersize , " Sound controls " ) ;
Cvar_Register ( & snd_samplebits , " Sound controls " ) ;
2012-02-27 12:23:15 +00:00
Cvar_Register ( & snd_playbackrate , " Sound controls " ) ;
2019-10-05 06:36:45 +00:00
Cvar_Register ( & snd_ignoregamespeed , " Sound controls " ) ;
2016-07-12 00:40:13 +00:00
Cvar_Register ( & snd_doppler , " Sound controls " ) ;
Cvar_Register ( & snd_doppler_min , " Sound controls " ) ;
Cvar_Register ( & snd_doppler_max , " Sound controls " ) ;
2004-08-23 00:15:46 +00:00
2004-10-03 22:52:02 +00:00
Cvar_Register ( & snd_inactive , " Sound controls " ) ;
2013-04-07 08:59:05 +00:00
# ifdef MULTITHREAD
Cvar_Register ( & snd_mixerthread , " Sound controls " ) ;
# endif
2005-05-26 12:55:34 +00:00
Cvar_Register ( & snd_playersoundvolume , " Sound controls " ) ;
2013-07-26 17:19:06 +00:00
Cvar_Register ( & snd_device , " Sound controls " ) ;
2013-09-06 22:57:44 +00:00
Cvar_Register ( & snd_device_opts , " Sound controls " ) ;
2005-06-14 04:52:10 +00:00
2020-03-07 09:00:40 +00:00
Cvar_Register ( & snd_ignorecueloops , " Sound controls " ) ;
2006-05-08 06:44:47 +00:00
Cvar_Register ( & snd_linearresample , " Sound controls " ) ;
2006-06-04 01:43:52 +00:00
Cvar_Register ( & snd_linearresample_stream , " Sound controls " ) ;
2006-05-08 06:44:47 +00:00
2013-09-06 22:57:44 +00:00
# ifdef VOICECHAT
S_Voip_Init ( ) ;
# endif
2012-02-27 12:23:15 +00:00
# ifdef MULTITHREAD
mixermutex = Sys_CreateMutex ( ) ;
# endif
2017-09-20 11:27:13 +00:00
for ( i = 0 ; outputdrivers [ i ] ; i + + )
{
sounddriver_t * sd = outputdrivers [ i ] ;
if ( sd & & sd - > name & & sd - > RegisterCvars )
sd - > RegisterCvars ( ) ;
}
2010-03-14 14:35:56 +00:00
2005-08-12 17:57:22 +00:00
if ( COM_CheckParm ( " -nosound " ) )
{
Cvar_ForceSet ( & nosound , " 1 " ) ;
nosound . flags | = CVAR_NOSET ;
return ;
}
2016-07-30 17:59:55 +00:00
S_EnumerateDevices ( ) ;
2005-08-12 17:57:22 +00:00
p = COM_CheckParm ( " -soundspeed " ) ;
2011-09-03 03:49:43 +00:00
if ( ! p )
p = COM_CheckParm ( " -sspeed " ) ;
if ( ! p )
p = COM_CheckParm ( " -sndspeed " ) ;
2005-08-12 17:57:22 +00:00
if ( p )
{
if ( p < com_argc - 1 )
2011-09-03 03:49:43 +00:00
Cvar_SetValue ( & snd_khz , atof ( com_argv [ p + 1 ] ) ) ;
2005-08-12 17:57:22 +00:00
else
Sys_Error ( " S_Init: you must specify a speed in KB after -soundspeed " ) ;
}
2005-06-14 04:52:10 +00:00
2004-08-23 00:15:46 +00:00
snd_initialized = true ;
2013-07-14 12:22:51 +00:00
known_sfx = Z_Malloc ( MAX_SFX * sizeof ( sfx_t ) ) ;
2004-08-23 00:15:46 +00:00
num_sfx = 0 ;
}
// =======================================================================
// Shutdown sound engine
// =======================================================================
void S_ShutdownCard ( soundcardinfo_t * sc )
{
2016-02-10 23:23:43 +00:00
soundcardinfo_t * * link ;
2006-09-17 00:59:22 +00:00
2016-02-10 23:23:43 +00:00
for ( link = & sndcardinfo ; * link ; link = & ( * link ) - > next )
2005-06-14 04:52:10 +00:00
{
2016-02-10 23:23:43 +00:00
if ( * link = = sc )
2006-09-17 00:59:22 +00:00
{
2016-02-10 23:23:43 +00:00
* link = sc - > next ;
if ( sc - > Shutdown )
sc - > Shutdown ( sc ) ;
2017-01-24 10:27:39 +00:00
Z_Free ( sc - > channel ) ;
2016-02-10 23:23:43 +00:00
Z_Free ( sc ) ;
break ;
2006-09-17 00:59:22 +00:00
}
2005-06-14 04:52:10 +00:00
}
2004-08-23 00:15:46 +00:00
}
2013-08-21 07:14:39 +00:00
void S_Shutdown ( qboolean final )
2005-06-14 04:52:10 +00:00
{
2004-08-23 00:15:46 +00:00
soundcardinfo_t * sc , * next ;
2006-09-17 00:59:22 +00:00
2016-02-10 23:23:43 +00:00
# if defined(_WIN32) && !defined(FTE_SDL)
INS_SetupControllerAudioDevices ( false ) ;
# endif
2004-08-23 00:15:46 +00:00
for ( sc = sndcardinfo ; sc ; sc = next )
{
next = sc - > next ;
2006-09-17 00:59:22 +00:00
sc - > Shutdown ( sc ) ;
2017-04-18 11:12:17 +00:00
Z_Free ( sc - > channel ) ;
2004-08-23 00:15:46 +00:00
Z_Free ( sc ) ;
sndcardinfo = next ;
}
sound_started = 0 ;
2012-02-27 12:23:15 +00:00
S_Purge ( false ) ;
2012-05-09 15:30:53 +00:00
2013-07-14 12:22:51 +00:00
Z_Free ( known_sfx ) ;
known_sfx = NULL ;
2012-05-09 15:30:53 +00:00
num_sfx = 0 ;
2014-10-05 20:04:11 +00:00
2016-07-12 00:40:13 +00:00
if ( final )
{
Z_Free ( reverbproperties ) ;
reverbproperties = NULL ;
numreverbproperties = 0 ;
}
2014-10-05 20:04:11 +00:00
# ifdef MULTITHREAD
if ( final & & mixermutex )
{
Sys_DestroyMutex ( mixermutex ) ;
mixermutex = NULL ;
}
# endif
2004-08-23 00:15:46 +00:00
}
// =======================================================================
// Load a sound
// =======================================================================
/*
= = = = = = = = = = = = = = = = = =
S_FindName
2012-02-27 12:23:15 +00:00
also touches it
2004-08-23 00:15:46 +00:00
= = = = = = = = = = = = = = = = = =
*/
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
sfx_t * S_FindName ( const char * name , qboolean create , qboolean syspath )
2004-08-23 00:15:46 +00:00
{
int i ;
sfx_t * sfx ;
if ( ! name )
Sys_Error ( " S_FindName: NULL \n " ) ;
if ( Q_strlen ( name ) > = MAX_OSPATH )
Sys_Error ( " Sound name too long: %s " , name ) ;
// see if already loaded
for ( i = 0 ; i < num_sfx ; i + + )
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
if ( ! Q_strcmp ( known_sfx [ i ] . name , name ) & & known_sfx [ i ] . syspath = = syspath )
2004-08-23 00:15:46 +00:00
{
2012-02-27 12:23:15 +00:00
known_sfx [ i ] . touched = true ;
2004-08-23 00:15:46 +00:00
return & known_sfx [ i ] ;
}
if ( num_sfx = = MAX_SFX )
Sys_Error ( " S_FindName: out of sfx_t " ) ;
2005-06-14 04:52:10 +00:00
2021-06-21 13:43:40 +00:00
if ( create & & known_sfx )
2014-10-05 20:04:11 +00:00
{
sfx = & known_sfx [ i ] ;
strcpy ( sfx - > name , name ) ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
sfx - > syspath = syspath ;
sfx - > touched = true ;
2004-08-23 00:15:46 +00:00
2014-10-05 20:04:11 +00:00
num_sfx + + ;
}
else
sfx = NULL ;
2005-06-14 04:52:10 +00:00
2004-08-23 00:15:46 +00:00
return sfx ;
}
2012-02-27 12:23:15 +00:00
void S_Purge ( qboolean retaintouched )
{
sfx_t * sfx ;
int i ;
2013-03-12 22:53:23 +00:00
//make sure ambients are kept. silly ambients.
if ( retaintouched )
{
ambient_sfx [ AMBIENT_WATER ] = S_PrecacheSound ( " ambience/water1.wav " ) ;
ambient_sfx [ AMBIENT_SKY ] = S_PrecacheSound ( " ambience/wind2.wav " ) ;
}
2013-03-12 23:09:49 +00:00
if ( ! num_sfx )
return ;
2012-02-27 12:23:15 +00:00
S_LockMixer ( ) ;
for ( i = 0 ; i < num_sfx ; i + + )
{
sfx = & known_sfx [ i ] ;
2014-10-05 20:04:11 +00:00
/*don't hurt sounds if they're being processed by a worker thread*/
if ( sfx - > loadstate = = SLS_LOADING )
2015-12-28 17:41:39 +00:00
{
if ( retaintouched )
continue ; //don't bother waiting
//trying to shut down or something.
//make sure there's no worker about to write to sfx after the memory is freed
COM_WorkerPartialSync ( sfx , & sfx - > loadstate , SLS_LOADING ) ;
}
2012-02-27 12:23:15 +00:00
/*don't purge the file if its still relevent*/
if ( retaintouched & & sfx - > touched )
continue ;
2015-07-14 14:47:00 +00:00
if ( S_IsPlayingSomewhere ( sfx ) )
continue ; //eep?!?
2014-10-05 20:04:11 +00:00
sfx - > loadstate = SLS_NOTLOADED ;
2012-02-27 12:23:15 +00:00
/*nothing to do if there's no data within*/
if ( ! sfx - > decoder . buf )
continue ;
/*stop the decoder first*/
2014-09-12 13:14:51 +00:00
if ( sfx - > decoder . purge )
sfx - > decoder . purge ( sfx ) ;
else if ( sfx - > decoder . ended )
sfx - > decoder . ended ( sfx ) ;
2012-02-27 12:23:15 +00:00
/*if there's any data associated still, kill it. if present, it should be a single sfxcache_t (with data in same alloc)*/
if ( sfx - > decoder . buf )
BZ_Free ( sfx - > decoder . buf ) ;
2012-05-09 15:30:53 +00:00
memset ( & sfx - > decoder , 0 , sizeof ( sfx - > decoder ) ) ;
2012-02-27 12:23:15 +00:00
}
S_UnlockMixer ( ) ;
}
2006-10-05 22:11:17 +00:00
void S_ResetFailedLoad ( void )
{
int i ;
for ( i = 0 ; i < num_sfx ; i + + )
2014-10-05 20:04:11 +00:00
{
if ( known_sfx [ i ] . loadstate = = SLS_FAILED )
known_sfx [ i ] . loadstate = SLS_NOTLOADED ;
}
2006-10-05 22:11:17 +00:00
}
2012-02-27 12:23:15 +00:00
void S_UntouchAll ( void )
{
int i ;
for ( i = 0 ; i < num_sfx ; i + + )
known_sfx [ i ] . touched = false ;
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = = =
S_PrecacheSound
= = = = = = = = = = = = = = = = = =
*/
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
sfx_t * S_PrecacheSound2 ( const char * name , qboolean syspath )
2004-08-23 00:15:46 +00:00
{
sfx_t * sfx ;
2014-10-05 20:04:11 +00:00
if ( nosound . ival | | ! known_sfx | | ! * name )
2004-08-23 00:15:46 +00:00
return NULL ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
sfx = S_FindName ( name , true , syspath ) ;
2005-06-14 04:52:10 +00:00
2004-08-23 00:15:46 +00:00
// cache it in
2020-06-12 23:29:58 +00:00
if ( snd_precache . ival & & snd_precache . ival ! = 2 & & sndcardinfo )
2018-09-23 19:35:24 +00:00
S_LoadSound ( sfx , true ) ;
2005-06-14 04:52:10 +00:00
2004-08-23 00:15:46 +00:00
return sfx ;
}
//=============================================================================
/*
= = = = = = = = = = = = = = = = =
SND_PickChannel
= = = = = = = = = = = = = = = = =
*/
channel_t * SND_PickChannel ( soundcardinfo_t * sc , int entnum , int entchannel )
{
2016-01-18 05:22:07 +00:00
int ch_idx ;
int oldest ;
2004-08-23 00:15:46 +00:00
2021-11-14 00:34:59 +00:00
// Check for replacement sound, or an idle channel
2016-01-18 05:22:07 +00:00
oldest = - 1 ;
2021-11-14 00:34:59 +00:00
for ( ch_idx = DYNAMIC_FIRST ; ch_idx < sc - > max_chans ; ch_idx + + )
2016-01-18 05:22:07 +00:00
{
2004-08-23 00:15:46 +00:00
if ( entchannel ! = 0 // channel 0 never overrides
& & sc - > channel [ ch_idx ] . entnum = = entnum
2016-01-18 05:22:07 +00:00
& & sc - > channel [ ch_idx ] . entchannel = = entchannel )
2005-07-28 15:33:27 +00:00
{ // always override sound from same entity
2012-02-27 12:23:15 +00:00
oldest = ch_idx ;
2004-08-23 00:15:46 +00:00
break ;
}
2012-02-27 12:23:15 +00:00
if ( ! sc - > channel [ ch_idx ] . sfx )
oldest = ch_idx ;
}
2004-08-23 00:15:46 +00:00
2012-02-27 12:23:15 +00:00
if ( oldest = = - 1 )
2021-11-14 00:34:59 +00:00
{
oldest = sc - > max_chans ;
Z_ReallocElements ( ( void * * ) & sc - > channel , & sc - > max_chans , oldest + 1 , sizeof ( * sc - > channel ) ) ;
}
2004-08-23 00:15:46 +00:00
2021-08-04 21:18:04 +00:00
sc - > channel [ oldest ] . sfx = NULL ;
2004-08-23 00:15:46 +00:00
2012-02-27 12:23:15 +00:00
if ( sc - > total_chans < = oldest )
sc - > total_chans = oldest + 1 ;
2019-02-24 08:32:45 +00:00
# ifdef Q3CLIENT //presumably we should be using this instead of pos for oldest, but blurgh.
sc - > channel [ oldest ] . starttime = Sys_Milliseconds ( ) ;
# endif
2016-01-18 05:22:07 +00:00
return & sc - > channel [ oldest ] ;
2005-06-14 04:52:10 +00:00
}
2004-08-23 00:15:46 +00:00
2016-01-18 05:22:07 +00:00
static void SND_AccumulateSpacialization ( soundcardinfo_t * sc , channel_t * ch , vec3_t origin )
{
vec3_t listener_vec ;
vec_t dist ;
vec_t scale ;
vec3_t world_vec ;
int i , v ;
float volscale ;
int seat ;
2018-10-17 00:43:04 +00:00
if ( ch - > flags & CF_CL_ABSVOLUME )
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
volscale = mastervolume . value ;
2016-01-18 05:22:07 +00:00
else
volscale = volume . value * voicevolumemod ;
if ( sc - > seat = = - 1 )
{
seat = 0 ;
VectorSubtract ( origin , listener [ seat ] . origin , world_vec ) ;
dist = DotProduct ( world_vec , world_vec ) ;
for ( i = 1 ; i < cl . splitclients ; i + + )
{
VectorSubtract ( origin , listener [ i ] . origin , world_vec ) ;
scale = DotProduct ( world_vec , world_vec ) ;
if ( scale < dist )
{
dist = scale ;
seat = i ;
}
}
}
else
{
seat = sc - > seat ;
}
// anything coming from the view entity will always be full volume
if ( ch - > entnum = = listener [ seat ] . entnum )
{
v = ch - > master_vol * ( ruleset_allow_localvolume . value ? snd_playersoundvolume . value : 1 ) * volscale ;
v = bound ( 0 , v , 255 ) ;
for ( i = 0 ; i < sc - > sn . numchannels ; i + + )
ch - > vol [ i ] = v ;
return ;
}
// calculate stereo seperation and distance attenuation
VectorSubtract ( origin , listener [ seat ] . origin , world_vec ) ;
dist = VectorNormalize ( world_vec ) * ch - > dist_mult ;
2016-12-07 18:45:25 +00:00
if ( ( ch - > flags & CF_NOSPACIALISE ) | | ! ch - > dist_mult )
2016-01-18 05:22:07 +00:00
{
scale = 1 ;
scale = ( 1.0 - dist ) * scale ;
v = ch - > master_vol * scale * volscale ;
for ( i = 0 ; i < sc - > sn . numchannels ; i + + )
ch - > vol [ i ] + = bound ( 0 , v , 255 ) ;
return ;
}
//rotate the world_vec into listener space, so that the audio direction stored in the speakerdir array can be used directly.
listener_vec [ 0 ] = DotProduct ( listener [ seat ] . forward , world_vec ) ;
listener_vec [ 1 ] = DotProduct ( listener [ seat ] . right , world_vec ) ;
listener_vec [ 2 ] = DotProduct ( listener [ seat ] . up , world_vec ) ;
if ( snd_leftisright . ival )
listener_vec [ 1 ] = - listener_vec [ 1 ] ;
for ( i = 0 ; i < sc - > sn . numchannels ; i + + )
{
scale = 1 + DotProduct ( listener_vec , sc - > speakerdir [ i ] ) ;
scale = ( 1.0 - dist ) * scale * sc - > dist [ i ] ;
v = ch - > master_vol * scale * volscale ;
ch - > vol [ i ] + = bound ( 0 , v , 255 ) ;
}
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = =
SND_Spatialize
= = = = = = = = = = = = = = = = =
*/
2016-01-18 05:22:07 +00:00
static void SND_Spatialize ( soundcardinfo_t * sc , channel_t * ch )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
vec3_t listener_vec , sound_vel ;
2015-07-27 08:21:34 +00:00
vec_t dist ;
vec_t scale ;
vec3_t world_vec ;
2013-05-31 01:16:07 +00:00
int i , v ;
2015-07-27 08:21:34 +00:00
float volscale ;
2016-01-18 05:22:07 +00:00
int seat ;
2016-07-12 00:40:13 +00:00
if ( ch - > flags & CF_FOLLOW )
{
//sounds following ents should update their position to match that ent's position.
2016-01-18 05:22:07 +00:00
//its important that they do not snap back to where they were if the entity vanishes, so we just overwrite the channel origin for that. its simpler.
2016-07-12 00:40:13 +00:00
# ifdef CSQC_DAT
if ( ch - > entnum < 0 & & - ch - > entnum < csqc_world . num_edicts )
{
2018-04-06 17:21:15 +00:00
wedict_t * ed = WEDICT_NUM_PB ( csqc_world . progs , - ch - > entnum ) ;
2016-07-12 00:40:13 +00:00
if ( ed - > ereftype = = ER_ENTITY )
{
VectorCopy ( ed - > v - > origin , ch - > origin ) ;
VectorCopy ( ed - > v - > velocity , ch - > velocity ) ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
if ( ed - > v - > solid = = SOLID_BSP )
{
VectorMA ( ch - > origin , 0.5 , ed - > v - > absmin , ch - > origin ) ;
VectorMA ( ch - > origin , 0.5 , ed - > v - > absmax , ch - > origin ) ;
}
}
}
else
# endif
if ( ch - > entnum > 0 & & ch - > entnum < cl . maxlerpents & & cl . lerpents [ ch - > entnum ] . sequence = = cl . lerpentssequence )
{
lerpents_t * le = cl . lerpents + ch - > entnum ;
int midx = le - > entstate - > modelindex ;
VectorCopy ( le - > origin , ch - > origin ) ;
//VectorCopy(le->velocity, ch->velocity); //fixme: bmodels should use their center rather than their origin. check le->state->solid?
//bmodels should report the center of the entity rather than the origin (which is frequently at 0 0 0 or merely used as a pivot)
if ( le - > entstate - > solidsize = = ES_SOLID_BSP & & midx > 0 & & midx < countof ( cl . model_precache ) )
{
if ( cl . model_precache [ midx ] & & cl . model_precache [ midx ] - > loadstate = = MLS_LOADED & & cl . model_precache [ midx ] - > type = = mod_brush )
{
//fixme: should probably deal with rotations.
VectorMA ( ch - > origin , 0.5 , cl . model_precache [ midx ] - > mins , ch - > origin ) ;
VectorMA ( ch - > origin , 0.5 , cl . model_precache [ midx ] - > maxs , ch - > origin ) ;
}
}
}
2016-01-18 05:22:07 +00:00
//FIXME: update rate to provide doppler
}
2016-07-12 00:40:13 +00:00
2015-07-27 08:21:34 +00:00
//sounds with absvolume ignore all volume etc cvars+settings
2018-10-17 00:43:04 +00:00
if ( ch - > flags & CF_CL_ABSVOLUME )
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
volscale = mastervolume . value ;
2015-07-27 08:21:34 +00:00
else
volscale = volume . value * voicevolumemod ;
2018-10-17 00:43:04 +00:00
if ( ! vid . activeapp & & ! snd_inactive . ival & & ! ( ch - > flags & CF_CLI_INACTIVE ) )
2018-03-05 11:34:20 +00:00
volscale = 0 ;
2016-01-18 05:22:07 +00:00
if ( sc - > seat = = - 1 )
{
seat = 0 ;
VectorSubtract ( ch - > origin , listener [ seat ] . origin , world_vec ) ;
dist = DotProduct ( world_vec , world_vec ) ;
2018-03-25 09:36:14 +00:00
# if MAX_SPLITS > 1
2016-01-18 05:22:07 +00:00
for ( i = 1 ; i < cl . splitclients ; i + + )
{
VectorSubtract ( ch - > origin , listener [ i ] . origin , world_vec ) ;
scale = DotProduct ( world_vec , world_vec ) ;
if ( scale < dist )
{
dist = scale ;
seat = i ;
}
}
2018-03-25 09:36:14 +00:00
# endif
2016-01-18 05:22:07 +00:00
}
else
{
seat = sc - > seat ;
}
2015-07-27 08:21:34 +00:00
// anything coming from the view entity will always be full volume
2016-01-18 05:22:07 +00:00
// (no, I don't like this hack)
2016-07-12 00:40:13 +00:00
if ( ch - > entnum = = listener [ seat ] . entnum & & ch - > entnum )
2013-05-31 01:16:07 +00:00
{
2015-07-27 08:21:34 +00:00
v = ch - > master_vol * ( ruleset_allow_localvolume . value ? snd_playersoundvolume . value : 1 ) * volscale ;
2013-05-31 01:16:07 +00:00
v = bound ( 0 , v , 255 ) ;
2005-01-13 16:29:20 +00:00
for ( i = 0 ; i < sc - > sn . numchannels ; i + + )
2013-05-31 01:16:07 +00:00
ch - > vol [ i ] = v ;
2004-08-23 00:15:46 +00:00
return ;
}
// calculate stereo seperation and distance attenuation
2016-01-18 05:22:07 +00:00
VectorSubtract ( ch - > origin , listener [ seat ] . origin , world_vec ) ;
2005-06-14 04:52:10 +00:00
2010-11-06 23:05:29 +00:00
dist = VectorNormalize ( world_vec ) * ch - > dist_mult ;
2005-06-14 04:52:10 +00:00
2016-12-07 18:45:25 +00:00
if ( ( ch - > flags & CF_NOSPACIALISE ) | | ! ch - > dist_mult )
2015-07-27 08:21:34 +00:00
{
scale = 1 ;
scale = ( 1.0 - dist ) * scale ;
v = ch - > master_vol * scale * volscale ;
2020-10-26 06:30:35 +00:00
v = bound ( 0 , v , 255 ) ;
2015-07-27 08:21:34 +00:00
for ( i = 0 ; i < sc - > sn . numchannels ; i + + )
2020-10-26 06:30:35 +00:00
ch - > vol [ i ] = v ;
2015-07-27 08:21:34 +00:00
return ;
}
2016-07-12 00:40:13 +00:00
//an attempt at doppler.
if ( snd_doppler . value )
{
//according to feh, the speed of sound is about 9000 qu/s.
VectorAdd ( listener [ seat ] . velocity , ch - > velocity , sound_vel ) ;
scale = 1 + snd_doppler . value * DotProduct ( world_vec , sound_vel ) / ( 9000.0 ) ;
if ( scale > snd_doppler_max . value )
scale = snd_doppler_max . value ;
if ( scale < snd_doppler_min . value )
scale = snd_doppler_min . value ;
ch - > rate = ( 1 < < PITCHSHIFT ) * scale + 0.5 ;
if ( ch - > rate < 1 ) //too small values result in crashes.
ch - > rate = 1 ;
}
2013-03-12 22:53:23 +00:00
//rotate the world_vec into listener space, so that the audio direction stored in the speakerdir array can be used directly.
2016-01-18 05:22:07 +00:00
listener_vec [ 0 ] = DotProduct ( listener [ seat ] . forward , world_vec ) ;
listener_vec [ 1 ] = DotProduct ( listener [ seat ] . right , world_vec ) ;
listener_vec [ 2 ] = DotProduct ( listener [ seat ] . up , world_vec ) ;
2004-08-23 00:15:46 +00:00
2009-11-04 21:16:50 +00:00
if ( snd_leftisright . ival )
2010-11-06 23:05:29 +00:00
listener_vec [ 1 ] = - listener_vec [ 1 ] ;
2009-11-04 21:16:50 +00:00
2005-01-13 16:29:20 +00:00
for ( i = 0 ; i < sc - > sn . numchannels ; i + + )
2004-08-23 00:15:46 +00:00
{
2013-03-12 22:53:23 +00:00
scale = 1 + DotProduct ( listener_vec , sc - > speakerdir [ i ] ) ;
2005-01-13 16:29:20 +00:00
scale = ( 1.0 - dist ) * scale * sc - > dist [ i ] ;
2015-07-27 08:21:34 +00:00
v = ch - > master_vol * scale * volscale ;
2020-10-26 06:30:35 +00:00
v = bound ( 0 , v , 255 ) ;
ch - > vol [ i ] = v ;
2004-08-23 00:15:46 +00:00
}
}
// =======================================================================
// Start a sound effect
// =======================================================================
2017-01-29 13:10:53 +00:00
static void S_UpdateSoundCard ( soundcardinfo_t * sc , qboolean updateonly , channel_t * target_chan , int entnum , int entchannel , sfx_t * sfx , vec3_t origin , vec3_t velocity , float fvol , float attenuation , float timeoffset , float ratemul , unsigned int flags )
2004-08-23 00:15:46 +00:00
{
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
channel_t * check ;
2004-08-23 00:15:46 +00:00
int vol ;
int ch_idx ;
int skip ;
2019-11-25 04:20:56 +00:00
int absstartpos = updateonly ? sc - > GetChannelPos ? sc - > GetChannelPos ( sc , target_chan ) < < PITCHSHIFT : target_chan - > pos : 0 ;
2016-07-12 00:40:13 +00:00
extern cvar_t cl_demospeed ;
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
chanupdatereason_t chanupdatetype = updateonly ? CUR_UPDATE : CUR_EVERYTHING ;
2004-08-23 00:15:46 +00:00
2017-12-03 03:03:02 +00:00
if ( ! sfx )
sfx = target_chan - > sfx ;
if ( fvol < 0 | | ! sfx )
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
{ //stopsound, apparently.
target_chan - > sfx = NULL ;
2004-08-23 00:15:46 +00:00
return ;
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
}
2004-08-23 00:15:46 +00:00
2022-05-05 23:28:33 +00:00
if ( timeoffset ! = 0.0 )
chanupdatetype | = CUR_OFFSET ;
2020-01-20 18:43:46 +00:00
if ( ! ratemul ) //rate of 0
ratemul = 1 ;
2019-10-05 06:36:45 +00:00
ratemul * = snd_playbackrate . value ;
if ( ! snd_ignoregamespeed . ival )
ratemul * = ( cls . state ? cl . gamespeed : 1 ) * ( cls . demoplayback ? cl_demospeed . value : 1 ) ;
2020-01-20 18:43:46 +00:00
if ( ratemul < = 0 ) //in case the user set the cvars weirdly
2017-01-29 13:10:53 +00:00
ratemul = 1 ;
2010-11-28 19:14:21 +00:00
2004-08-23 00:15:46 +00:00
vol = fvol * 255 ;
// spatialize
2017-12-03 03:03:02 +00:00
if ( target_chan - > sfx ! = sfx )
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
chanupdatetype | = CUR_SOUNDCHANGE ;
2022-05-05 23:28:33 +00:00
2004-08-23 00:15:46 +00:00
memset ( target_chan , 0 , sizeof ( * target_chan ) ) ;
if ( ! origin )
{
2016-01-18 05:22:07 +00:00
if ( sc - > seat = = - 1 )
{
VectorClear ( target_chan - > origin ) ;
attenuation = 0 ;
flags | = CF_NOSPACIALISE ;
}
else
VectorCopy ( listener [ sc - > seat ] . origin , target_chan - > origin ) ;
2004-08-23 00:15:46 +00:00
}
else
{
VectorCopy ( origin , target_chan - > origin ) ;
}
2016-07-12 00:40:13 +00:00
if ( velocity )
VectorCopy ( velocity , target_chan - > velocity ) ;
else
VectorClear ( target_chan - > velocity ) ;
2015-07-27 08:21:34 +00:00
target_chan - > flags = flags ;
2019-07-19 02:13:19 +00:00
target_chan - > dist_mult = attenuation / snd_nominaldistance . value ;
2004-08-23 00:15:46 +00:00
target_chan - > master_vol = vol ;
target_chan - > entnum = entnum ;
target_chan - > entchannel = entchannel ;
SND_Spatialize ( sc , target_chan ) ;
2018-09-23 19:35:24 +00:00
if ( ! S_LoadSound ( sfx , false ) )
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
{
target_chan - > sfx = NULL ;
2018-07-22 11:49:37 +00:00
return ; // couldn't load the sound's data
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
}
2004-08-23 00:15:46 +00:00
2018-07-22 11:49:37 +00:00
//FIXME: why does this only filter for openal devices? its weird.
if ( ! updateonly & & ! target_chan - > vol [ 0 ] & & ! target_chan - > vol [ 1 ] & & ! target_chan - > vol [ 2 ] & & ! target_chan - > vol [ 3 ] & & ! target_chan - > vol [ 4 ] & & ! target_chan - > vol [ 5 ] & & sc - > ChannelUpdate )
if ( sfx - > loopstart = = - 1 & & ! ( flags & CF_FORCELOOP ) ) //only skip if its not looping.
2004-08-23 00:15:46 +00:00
{
2017-12-03 03:03:02 +00:00
target_chan - > sfx = NULL ;
2018-07-22 11:49:37 +00:00
return ; // not audible at all
2004-08-23 00:15:46 +00:00
}
2007-08-23 21:25:18 +00:00
2017-12-03 03:03:02 +00:00
target_chan - > sfx = sfx ;
2017-01-29 13:10:53 +00:00
target_chan - > rate = ( ( 1 < < PITCHSHIFT ) * ratemul ) ; //*sfx->rate/sc->sn.speed;
2012-02-27 12:23:15 +00:00
if ( target_chan - > rate < 1 ) /*make sure the rate won't crash us*/
target_chan - > rate = 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
target_chan - > pos = absstartpos + ( int ) ( timeoffset * sc - > sn . speed * target_chan - > rate ) ;
2005-06-14 04:52:10 +00:00
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 ( ! updateonly )
{
2004-08-23 00:15:46 +00:00
// if an identical sound has also been started this frame, offset the pos
// a bit to keep it from just making the first one louder
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
check = & sc - > channel [ DYNAMIC_FIRST ] ;
2021-11-14 00:34:59 +00:00
for ( ch_idx = DYNAMIC_FIRST ; ch_idx < sc - > total_chans ; ch_idx + + , check + + )
2004-08-23 00:15:46 +00:00
{
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 ( check = = target_chan )
continue ;
if ( check - > sfx = = sfx & & ! check - > pos )
{
skip = rand ( ) % ( int ) ( 0.1 * sc - > sn . speed ) ;
target_chan - > pos - = skip * target_chan - > rate ;
break ;
}
2004-08-23 00:15:46 +00:00
}
}
2010-12-05 02:46:07 +00:00
if ( sc - > ChannelUpdate )
2016-07-12 00:40:13 +00:00
sc - > ChannelUpdate ( sc , target_chan , chanupdatetype ) ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
float S_UpdateSound ( int entnum , int entchannel , sfx_t * sfx , vec3_t origin , vec3_t velocity , float fvol , float attenuation , float timeofs , float pitchadj , unsigned int flags )
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
{
int i ;
int result = 0 ;
int cards = 0 ;
soundcardinfo_t * sc ;
2017-12-15 06:56:40 +00:00
channel_t * chan ;
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 ( cls . demoseeking )
return result ;
S_LockMixer ( ) ;
for ( sc = sndcardinfo ; sc ; sc = sc - > next )
{
cards + + ;
for ( i = 0 ; i < sc - > total_chans ; i + + )
{
if ( sc - > channel [ i ] . entnum = = entnum & & sc - > channel [ i ] . entchannel = = entchannel & & sc - > channel [ i ] . sfx )
{
2016-07-12 00:40:13 +00:00
S_UpdateSoundCard ( sc , true , & sc - > channel [ i ] , entnum , entchannel , sfx , origin , velocity , fvol , attenuation , timeofs , pitchadj , flags ) ;
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
result + + ;
break ;
}
}
2017-12-15 06:56:40 +00:00
//start it if we couldn't find it.
if ( i = = sc - > total_chans & & sfx )
{
chan = SND_PickChannel ( sc , entnum , entchannel ) ;
if ( chan )
S_UpdateSoundCard ( sc , false , chan , entnum , entchannel , sfx , origin , velocity , fvol , attenuation , timeofs , pitchadj , flags ) ;
}
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
}
S_UnlockMixer ( ) ;
if ( ! cards )
cards = 1 ;
return result / ( float ) cards ;
}
2016-07-12 00:40:13 +00:00
void S_StartSound ( int entnum , int entchannel , sfx_t * sfx , vec3_t origin , vec3_t velocity , float fvol , float attenuation , float timeofs , float pitchadj , unsigned int flags )
2006-05-10 07:35:19 +00:00
{
soundcardinfo_t * sc ;
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
channel_t * target_chan ;
2006-05-10 07:35:19 +00:00
if ( ! sfx | | ! * sfx - > name ) //no named sounds would need specific starting.
return ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( cls . demoseeking )
return ;
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 ( ! sound_started )
return ;
if ( nosound . ival )
return ;
2012-02-27 12:23:15 +00:00
S_LockMixer ( ) ;
2006-05-10 07:35:19 +00:00
for ( sc = sndcardinfo ; sc ; sc = sc - > next )
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
{
2021-07-01 01:16:54 +00:00
if ( flags & CF_NOREPLACE )
{
int i ;
for ( i = 0 ; i < sc - > total_chans ; i + + )
if ( sc - > channel [ i ] . entnum = = entnum & & sc - > channel [ i ] . entchannel = = entchannel )
break ;
if ( i < sc - > total_chans )
continue ;
}
2019-02-24 08:32:45 +00:00
# ifdef Q3CLIENT
if ( flags & CF_CLI_NODUPES )
{ //don't start too many simultaneous sounds. q3 sucks or something.
int active = 0 , i ;
unsigned int time = Sys_Milliseconds ( ) ;
for ( i = 0 ; i < sc - > total_chans ; i + + )
{ //as per q3, channel isn't important.
if ( sc - > channel [ i ] . entnum = = entnum & & sc - > channel [ i ] . sfx = = sfx )
{
//never allow a new sound within 50ms of the previous one
if ( time - sc - > channel [ i ] . starttime < 50 )
break ;
active + + ;
}
}
if ( active > = 4 | | i < sc - > total_chans )
{
Con_DPrintf ( " CF_CLI_NODUPES strikes again! \n " ) ;
break ;
}
}
# endif
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
// pick a channel to play on
target_chan = SND_PickChannel ( sc , entnum , entchannel ) ;
if ( ! target_chan )
2015-08-28 03:13:45 +00:00
break ;
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
2016-07-12 00:40:13 +00:00
S_UpdateSoundCard ( sc , false , target_chan , entnum , entchannel , sfx , origin , velocity , fvol , attenuation , timeofs , pitchadj , flags ) ;
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-02-27 12:23:15 +00:00
S_UnlockMixer ( ) ;
2004-08-23 00:15:46 +00:00
}
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
qboolean S_GetMusicInfo ( int musicchannel , float * time , float * duration , char * title , size_t titlesize )
2015-07-14 14:47:00 +00:00
{
qboolean result = false ;
soundcardinfo_t * sc ;
sfx_t * sfx ;
* time = 0 ;
* duration = 0 ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
if ( titlesize )
* title = 0 ;
2015-07-14 14:47:00 +00:00
musicchannel + = MUSIC_FIRST ;
S_LockMixer ( ) ;
for ( sc = sndcardinfo ; sc ; sc = sc - > next )
{
sfx = sc - > channel [ musicchannel ] . sfx ;
if ( sfx )
{
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
Q_strncpyz ( title , COM_SkipPath ( sfx - > name ) , titlesize ) ;
if ( sfx - > loadstate = = SLS_LOADED )
2015-07-14 14:47:00 +00:00
{
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
if ( sfx - > decoder . querydata )
* duration = sfx - > decoder . querydata ( sfx , NULL , title , titlesize ) ;
else if ( sfx - > decoder . buf )
{
sfxcache_t * c = sfx - > decoder . buf ;
* duration = ( float ) c - > length / c - > speed ;
}
else
* duration = 0 ;
2015-07-14 14:47:00 +00:00
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
//FIXME: openal doesn't report the actual time.
* time = ( sc - > channel [ musicchannel ] . pos > > PITCHSHIFT ) / ( float ) snd_speed ; //the time into the sound, ignoring play rate.
result = true ;
}
2015-07-14 14:47:00 +00:00
}
}
S_UnlockMixer ( ) ;
return result ;
}
2014-05-13 23:21:20 +00:00
float S_GetSoundTime ( int entnum , int entchannel )
{
int i ;
float result = - 1 ; //if we didn't find one
soundcardinfo_t * sc ;
S_LockMixer ( ) ;
for ( sc = sndcardinfo ; sc & & result = = - 1 ; sc = sc - > next )
{
for ( i = 0 ; i < sc - > total_chans ; i + + )
{
if ( sc - > channel [ i ] . entnum = = entnum & & sc - > channel [ i ] . entchannel = = entchannel & & sc - > channel [ i ] . sfx )
{
2019-03-23 07:06:37 +00:00
ssamplepos_t spos = sc - > GetChannelPos ? sc - > GetChannelPos ( sc , & sc - > channel [ i ] ) : ( sc - > channel [ i ] . pos > > PITCHSHIFT ) ;
result = spos / ( float ) snd_speed ; //the time into the sound, ignoring play rate.
break ;
}
}
//we found one on this sound device card, ignore others.
if ( result ! = - 1 )
break ;
}
S_UnlockMixer ( ) ;
return result ;
}
float S_GetChannelLevel ( int entnum , int entchannel )
{
int i , j ;
float result = - 1 ; //if we didn't find one
soundcardinfo_t * sc ;
sfxcache_t scachebuf , * scache ;
S_LockMixer ( ) ;
for ( sc = sndcardinfo ; sc & & result = = - 1 ; sc = sc - > next )
{
for ( i = 0 ; i < sc - > total_chans ; i + + )
{
if ( sc - > channel [ i ] . entnum = = entnum & & sc - > channel [ i ] . entchannel = = entchannel & & sc - > channel [ i ] . sfx )
{
ssamplepos_t spos = sc - > GetChannelPos ? sc - > GetChannelPos ( sc , & sc - > channel [ i ] ) : ( sc - > channel [ i ] . pos > > PITCHSHIFT ) ;
2019-09-04 08:32:22 +00:00
if ( sc - > channel [ i ] . sfx - > decoder . decodedata )
scache = sc - > channel [ i ] . sfx - > decoder . decodedata ( sc - > channel [ i ] . sfx , & scachebuf , spos , 1 ) ;
2019-08-11 05:34:37 +00:00
else
scache = NULL ;
2019-03-23 07:06:37 +00:00
if ( ! scache )
scache = sc - > channel [ i ] . sfx - > decoder . buf ;
2019-09-04 08:32:22 +00:00
2019-03-23 07:06:37 +00:00
if ( scache & & spos > = scache - > soundoffset & & spos < scache - > soundoffset + scache - > length )
{
spos - = scache - > soundoffset ;
spos * = scache - > numchannels ;
2020-04-29 10:43:22 +00:00
switch ( scache - > format )
2019-03-23 07:06:37 +00:00
{
2020-04-29 12:25:24 +00:00
# ifdef FTE_TARGET_WEB
case QAF_BLOB :
result = 0 ; //sorry. you're going to have to use .wav :(
break ;
# endif
2020-04-29 10:43:22 +00:00
case QAF_S8 :
2019-03-23 07:06:37 +00:00
for ( j = 0 ; j < scache - > numchannels ; j + + ) //average the channels
result + = abs ( ( ( signed char * ) scache - > data ) [ spos + j ] ) ;
result / = scache - > numchannels * 127.0 ;
break ;
2020-04-29 10:43:22 +00:00
case QAF_S16 :
2019-03-23 07:06:37 +00:00
for ( j = 0 ; j < scache - > numchannels ; j + + ) //average the channels
result + = abs ( ( ( signed short * ) scache - > data ) [ spos + j ] ) ;
result / = scache - > numchannels * 32767.0 ;
break ;
2020-04-29 10:43:22 +00:00
# ifdef MIXER_F32
case QAF_F32 :
for ( j = 0 ; j < scache - > numchannels ; j + + ) //average the channels
result + = fabs ( ( ( float * ) scache - > data ) [ spos + j ] ) ;
result / = scache - > numchannels ;
break ;
# endif
2019-03-23 07:06:37 +00:00
}
}
else
result = 0 ;
2014-05-13 23:21:20 +00:00
break ;
}
}
//we found one on this sound device card, ignore others.
if ( result ! = - 1 )
break ;
}
S_UnlockMixer ( ) ;
return result ;
}
2004-08-23 00:15:46 +00:00
qboolean S_IsPlayingSomewhere ( sfx_t * s )
{
soundcardinfo_t * si ;
int i ;
for ( si = sndcardinfo ; si ; si = si - > next )
{
2006-05-28 21:56:04 +00:00
for ( i = 0 ; i < si - > total_chans ; i + + )
2004-08-23 00:15:46 +00:00
if ( si - > channel [ i ] . sfx = = s )
return true ;
}
return false ;
}
2012-02-27 12:23:15 +00:00
static void S_StopSoundCard ( soundcardinfo_t * sc , int entnum , int entchannel )
2004-08-23 00:15:46 +00:00
{
int i ;
for ( i = 0 ; i < sc - > total_chans ; i + + )
{
if ( sc - > channel [ i ] . entnum = = entnum
2010-08-21 13:31:39 +00:00
& & ( ! entchannel | | sc - > channel [ i ] . entchannel = = entchannel ) )
2004-08-23 00:15:46 +00:00
{
sc - > channel [ i ] . sfx = NULL ;
2010-12-05 02:46:07 +00:00
if ( sc - > ChannelUpdate )
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
sc - > ChannelUpdate ( sc , & sc - > channel [ i ] , CUR_EVERYTHING ) ;
2010-08-21 13:31:39 +00:00
if ( entchannel )
2012-02-27 12:23:15 +00:00
break ;
2004-08-23 00:15:46 +00:00
}
}
}
void S_StopSound ( int entnum , int entchannel )
{
soundcardinfo_t * sc ;
2012-02-27 12:23:15 +00:00
S_LockMixer ( ) ;
2004-08-23 00:15:46 +00:00
for ( sc = sndcardinfo ; sc ; sc = sc - > next )
S_StopSoundCard ( sc , entnum , entchannel ) ;
2012-02-27 12:23:15 +00:00
S_UnlockMixer ( ) ;
2004-08-23 00:15:46 +00:00
}
void S_StopAllSounds ( qboolean clear )
{
int i ;
sfx_t * s ;
2015-07-14 14:47:00 +00:00
channel_t musics [ NUM_MUSICS ] ;
2004-08-23 00:15:46 +00:00
soundcardinfo_t * sc ;
2012-02-27 12:23:15 +00:00
if ( ! sound_started )
return ;
S_LockMixer ( ) ;
2004-08-23 00:15:46 +00:00
for ( sc = sndcardinfo ; sc ; sc = sc - > next )
{
2015-10-27 15:20:15 +00:00
for ( i = sc - > total_chans ; i - - > 0 ; )
2015-07-14 14:47:00 +00:00
{
if ( i > = MUSIC_FIRST & & i < MUSIC_FIRST + NUM_MUSICS & & sc - > selfpainting )
continue ; //don't reset music if is safe to continue playing it without stuttering
2015-10-27 15:20:15 +00:00
s = sc - > channel [ i ] . sfx ;
if ( s )
2004-08-23 00:15:46 +00:00
{
2015-10-27 15:20:15 +00:00
sc - > channel [ i ] . sfx = NULL ;
if ( s - > loadstate = = SLS_LOADED & & s - > decoder . ended )
if ( ! S_IsPlayingSomewhere ( s ) ) //if we aint playing it elsewhere, free it compleatly.
2004-08-23 00:15:46 +00:00
{
2015-06-12 14:44:50 +00:00
if ( s - > decoder . ended )
s - > decoder . ended ( s ) ;
2004-08-23 00:15:46 +00:00
}
2015-10-27 15:20:15 +00:00
if ( sc - > ChannelUpdate )
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
sc - > ChannelUpdate ( sc , & sc - > channel [ i ] , CUR_EVERYTHING ) ;
2004-08-23 00:15:46 +00:00
}
2015-07-14 14:47:00 +00:00
}
2004-08-23 00:15:46 +00:00
2021-11-14 00:34:59 +00:00
sc - > total_chans = NUM_AMBIENTS + NUM_MUSICS ; // no statics
2017-01-13 00:39:50 +00:00
Z_ReallocElements ( ( void * * ) & sc - > channel , & sc - > max_chans , sc - > total_chans , sizeof ( * sc - > channel ) ) ;
2006-05-28 21:56:04 +00:00
2015-07-14 14:47:00 +00:00
memcpy ( musics , & sc - > channel [ MUSIC_FIRST ] , sizeof ( musics ) ) ;
2017-01-13 00:39:50 +00:00
Q_memset ( sc - > channel , 0 , sc - > max_chans * sizeof ( channel_t ) ) ;
2015-07-14 14:47:00 +00:00
memcpy ( & sc - > channel [ MUSIC_FIRST ] , musics , sizeof ( musics ) ) ;
2004-08-23 00:15:46 +00:00
2015-07-14 14:47:00 +00:00
if ( clear & & ! sc - > selfpainting ) //if its self-painting, then the mixer will continue painting anyway (which is important if its still painting music, but otherwise don't stutter at all when loading)
2004-08-23 00:15:46 +00:00
S_ClearBuffer ( sc ) ;
}
2012-02-27 12:23:15 +00:00
S_UnlockMixer ( ) ;
2004-08-23 00:15:46 +00:00
}
2012-02-27 12:23:15 +00:00
static void S_StopAllSounds_f ( void )
2004-08-23 00:15:46 +00:00
{
S_StopAllSounds ( true ) ;
}
2012-02-27 12:23:15 +00:00
static void S_ClearBuffer ( soundcardinfo_t * sc )
2004-08-23 00:15:46 +00:00
{
2005-06-14 04:52:10 +00:00
void * buffer ;
2012-04-09 19:12:12 +00:00
unsigned int dummy ;
2005-06-14 04:52:10 +00:00
2004-08-23 00:15:46 +00:00
int clear ;
2006-02-01 22:36:12 +00:00
2004-08-23 00:15:46 +00:00
if ( ! sound_started | | ! sc - > sn . buffer )
return ;
2017-09-20 11:27:13 +00:00
if ( sc - > sn . sampleformat = = QSF_U8 )
2004-08-23 00:15:46 +00:00
clear = 0x80 ;
else
clear = 0 ;
2012-04-09 19:12:12 +00:00
dummy = 0 ;
buffer = sc - > Lock ( sc , & dummy ) ;
2005-06-14 04:52:10 +00:00
if ( buffer )
{
2017-09-20 11:27:13 +00:00
Q_memset ( buffer , clear , sc - > sn . samples * sc - > sn . samplebytes ) ;
2005-06-14 04:52:10 +00:00
sc - > Unlock ( sc , buffer ) ;
}
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = = = = =
S_StaticSound
= = = = = = = = = = = = = = = = =
*/
void S_StaticSound ( sfx_t * sfx , vec3_t origin , float vol , float attenuation )
{
channel_t * ss ;
soundcardinfo_t * scard ;
if ( ! sfx )
return ;
2012-02-27 12:23:15 +00:00
S_LockMixer ( ) ;
2004-08-23 00:15:46 +00:00
for ( scard = sndcardinfo ; scard ; scard = scard - > next )
{
2017-01-13 00:39:50 +00:00
if ( scard - > total_chans = = scard - > max_chans )
2004-08-23 00:15:46 +00:00
{
2017-01-13 00:39:50 +00:00
if ( ! ZF_ReallocElements ( ( void * * ) & scard - > channel , & scard - > max_chans , scard - > max_chans + 64 , sizeof ( * scard - > channel ) ) )
{
Con_Printf ( " total_channels == MAX_CHANNELS \n " ) ;
continue ;
}
2004-08-23 00:15:46 +00:00
}
2018-09-23 19:35:24 +00:00
if ( ! S_LoadSound ( sfx , true ) )
2012-02-27 12:23:15 +00:00
break ;
2004-08-23 00:15:46 +00:00
ss = & scard - > channel [ scard - > total_chans ] ;
scard - > total_chans + + ;
2015-07-27 08:21:34 +00:00
ss - > entnum = 0 ;
2004-08-23 00:15:46 +00:00
ss - > sfx = sfx ;
2010-11-06 23:05:29 +00:00
ss - > rate = 1 < < PITCHSHIFT ;
2004-08-23 00:15:46 +00:00
VectorCopy ( origin , ss - > origin ) ;
2015-08-10 18:28:23 +00:00
ss - > master_vol = vol * 255 ;
2019-07-19 02:13:19 +00:00
ss - > dist_mult = attenuation / snd_nominaldistance . value ;
2012-02-27 12:23:15 +00:00
ss - > pos = 0 ;
2021-11-14 00:34:59 +00:00
ss - > flags = CF_FORCELOOP | CF_CLI_STATIC ;
2005-06-14 04:52:10 +00:00
2004-08-23 00:15:46 +00:00
SND_Spatialize ( scard , ss ) ;
2010-12-05 02:46:07 +00:00
if ( scard - > ChannelUpdate )
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
scard - > ChannelUpdate ( scard , ss , CUR_EVERYTHING ) ;
2004-08-23 00:15:46 +00:00
}
2012-02-27 12:23:15 +00:00
S_UnlockMixer ( ) ;
2004-08-23 00:15:46 +00:00
}
//=============================================================================
2009-04-01 22:03:56 +00:00
void S_Music_Clear ( sfx_t * onlyifsample )
{
//stops the current BGM music
//calling this will trigger Media_NextTrack later
sfx_t * s ;
soundcardinfo_t * sc ;
int i ;
2010-11-06 23:05:29 +00:00
for ( i = MUSIC_FIRST ; i < MUSIC_STOP ; i + + )
2009-04-01 22:03:56 +00:00
{
for ( sc = sndcardinfo ; sc ; sc = sc - > next )
{
s = sc - > channel [ i ] . sfx ;
if ( ! s )
continue ;
if ( onlyifsample & & s ! = onlyifsample )
continue ;
2012-02-27 12:23:15 +00:00
sc - > channel [ i ] . pos = 0 ;
2009-04-01 22:03:56 +00:00
sc - > channel [ i ] . sfx = NULL ;
2015-04-21 04:12:00 +00:00
if ( sc - > ChannelUpdate )
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
sc - > ChannelUpdate ( sc , & sc - > channel [ i ] , CUR_EVERYTHING ) ;
2015-04-21 04:12:00 +00:00
2014-09-12 13:14:51 +00:00
if ( s & & s - > decoder . ended & & ! S_IsPlayingSomewhere ( s ) ) //if we aint playing it elsewhere, free it compleatly.
s - > decoder . ended ( s ) ;
2009-04-01 22:03:56 +00:00
}
}
}
void S_Music_Seek ( float time )
{
soundcardinfo_t * sc ;
int i ;
2010-11-06 23:05:29 +00:00
for ( i = MUSIC_FIRST ; i < MUSIC_STOP ; i + + )
2009-04-01 22:03:56 +00:00
{
for ( sc = sndcardinfo ; sc ; sc = sc - > next )
{
2010-11-06 23:05:29 +00:00
sc - > channel [ i ] . pos + = sc - > sn . speed * time * sc - > channel [ i ] . rate ;
2009-04-01 22:03:56 +00:00
if ( sc - > channel [ i ] . pos < 0 )
{ //clamp to the start of the track
sc - > channel [ i ] . pos = 0 ;
}
//if we seek over the end, ignore it. The sound playing code will spot that.
}
}
}
2015-07-14 14:47:00 +00:00
//mixer must be locked
qboolean S_Music_Playing ( int musicchannel )
{
soundcardinfo_t * sc ;
musicchannel + = MUSIC_FIRST ;
for ( sc = sndcardinfo ; sc ; sc = sc - > next )
{
if ( sc - > channel [ musicchannel ] . sfx )
return true ;
}
return false ;
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = = = =
S_UpdateAmbientSounds
= = = = = = = = = = = = = = = = = = =
*/
2005-11-30 01:20:53 +00:00
mleaf_t * Q1BSP_LeafForPoint ( model_t * model , vec3_t p ) ;
2004-08-23 00:15:46 +00:00
void S_UpdateAmbientSounds ( soundcardinfo_t * sc )
{
2017-01-13 00:39:50 +00:00
float vol ;
2004-08-23 00:15:46 +00:00
channel_t * chan ;
int i ;
2017-01-13 00:39:50 +00:00
# ifdef Q1BSPS
mleaf_t * l ;
float oldvol ;
2016-01-18 05:22:07 +00:00
int ambientlevel [ NUM_AMBIENTS ] ;
2017-01-13 00:39:50 +00:00
# endif
2004-08-23 00:15:46 +00:00
if ( ! snd_ambient )
return ;
2010-11-06 23:05:29 +00:00
for ( i = MUSIC_FIRST ; i < MUSIC_STOP ; i + + )
2004-08-23 00:15:46 +00:00
{
2020-02-11 18:06:10 +00:00
chanupdatereason_t changed = CUR_SPACIALISEONLY ;
2004-08-23 00:15:46 +00:00
chan = & sc - > channel [ i ] ;
2016-07-12 00:40:13 +00:00
if ( ! chan - > sfx )
{
float time = 0 ;
2020-03-27 00:49:13 +00:00
sfx_t * newmusic ;
if ( ! S_Music_Playing ( i - MUSIC_FIRST ) )
2016-07-12 00:40:13 +00:00
{
2020-03-27 00:49:13 +00:00
newmusic = Media_NextTrack ( i - MUSIC_FIRST , & time ) ;
if ( newmusic & & newmusic - > loadstate ! = SLS_FAILED )
{ //okay, now we know which track we're meant to be playing, all devices can play it at once.
soundcardinfo_t * sc2 ;
for ( sc2 = sndcardinfo ; sc2 ; sc2 = sc2 - > next )
{
channel_t * chan = & sc2 - > channel [ i ] ;
chan - > sfx = newmusic ;
chan - > rate = 1 < < PITCHSHIFT ;
chan - > pos = ( int ) ( time * sc - > sn . speed ) * chan - > rate ;
changed = CUR_EVERYTHING ;
chan - > master_vol = bound ( 0 , 1 , 255 ) ;
chan - > vol [ 0 ] = chan - > vol [ 1 ] = chan - > vol [ 2 ] = chan - > vol [ 3 ] = chan - > vol [ 4 ] = chan - > vol [ 5 ] = chan - > master_vol ;
if ( sc - > ChannelUpdate )
sc - > ChannelUpdate ( sc , chan , changed ) ;
}
}
2016-07-12 00:40:13 +00:00
}
}
2004-08-23 00:15:46 +00:00
if ( chan - > sfx )
2013-05-31 01:16:07 +00:00
{
2018-10-17 00:43:04 +00:00
chan - > flags = /*CF_CL_INACTIVE|*/ CF_CL_ABSVOLUME | CF_NOSPACIALISE | CF_NOREVERB ; //bypasses volume cvar completely.
2015-07-14 14:47:00 +00:00
vol = 255 * bgmvolume . value * voicevolumemod ;
2018-10-17 00:43:04 +00:00
if ( ! vid . activeapp & & ! snd_inactive . ival & & ! ( chan - > flags & CF_CLI_INACTIVE ) )
2018-03-05 11:34:20 +00:00
vol = 0 ;
2015-07-14 14:47:00 +00:00
vol = bound ( 0 , vol , 255 ) ;
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
vol = Media_CrossFade ( i - MUSIC_FIRST , vol , ( chan - > pos > > PITCHSHIFT ) / ( float ) snd_speed ) ;
2015-07-14 14:47:00 +00:00
if ( vol < 0 )
{ //cross fading wants to KILL this track now, apparently.
sfx_t * s = chan - > sfx ;
if ( s - > loadstate ! = SLS_LOADING )
{
chan - > pos = 0 ;
chan - > sfx = NULL ;
if ( sc - > ChannelUpdate )
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
sc - > ChannelUpdate ( sc , chan , CUR_EVERYTHING ) ;
2015-07-14 14:47:00 +00:00
if ( s & & s - > decoder . ended & & ! S_IsPlayingSomewhere ( s ) ) //if we aint playing it elsewhere, free it compleatly.
s - > decoder . ended ( s ) ;
}
}
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
else
{
chan - > master_vol = bound ( 0 , vol , 255 ) ;
chan - > vol [ 0 ] = chan - > vol [ 1 ] = chan - > vol [ 2 ] = chan - > vol [ 3 ] = chan - > vol [ 4 ] = chan - > vol [ 5 ] = chan - > master_vol ;
if ( sc - > ChannelUpdate )
sc - > ChannelUpdate ( sc , chan , changed ) ;
}
}
2004-08-23 00:15:46 +00:00
}
2017-01-13 00:39:50 +00:00
# ifdef Q1BSPS
2004-08-23 00:15:46 +00:00
// calc ambient sound levels
2016-01-18 05:22:07 +00:00
for ( i = 0 ; i < NUM_AMBIENTS ; i + + )
ambientlevel [ i ] = 0 ;
2016-07-12 00:40:13 +00:00
if ( cl . worldmodel & & cl . worldmodel - > type = = mod_brush & & cl . worldmodel - > fromgame = = fg_quake & & cl . worldmodel - > loadstate = = MLS_LOADED )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
if ( ambient_level . value )
2010-12-05 02:46:07 +00:00
{
2016-07-12 00:40:13 +00:00
if ( sc - > seat < 0 )
2016-01-18 05:22:07 +00:00
{
2016-07-12 00:40:13 +00:00
int seat = max ( 1 , cl . splitclients ) ;
while ( seat - - > 0 )
{
l = Q1BSP_LeafForPoint ( cl . worldmodel , listener [ seat ] . origin ) ;
if ( ! l )
continue ;
2016-01-18 05:22:07 +00:00
2016-07-12 00:40:13 +00:00
for ( i = 0 ; i < NUM_AMBIENTS ; i + + )
ambientlevel [ i ] = max ( ambientlevel [ i ] , l - > ambient_sound_level [ i ] ) ;
}
}
else
{
l = Q1BSP_LeafForPoint ( cl . worldmodel , listener [ sc - > seat ] . origin ) ;
if ( l )
for ( i = 0 ; i < NUM_AMBIENTS ; i + + )
ambientlevel [ i ] = l - > ambient_sound_level [ i ] ;
2016-01-18 05:22:07 +00:00
}
2010-12-05 02:46:07 +00:00
}
2004-08-23 00:15:46 +00:00
}
2016-01-18 05:22:07 +00:00
for ( i = 0 ; i < NUM_AMBIENTS ; i + + )
2004-08-23 00:15:46 +00:00
{
2016-01-18 05:22:07 +00:00
chan = & sc - > channel [ AMBIENT_FIRST + i ] ;
chan - > sfx = ambient_sfx [ AMBIENT_FIRST + i ] ;
chan - > entnum = 0 ;
2015-07-27 08:21:34 +00:00
chan - > flags = CF_FORCELOOP | CF_NOSPACIALISE ;
2010-11-06 23:05:29 +00:00
chan - > rate = 1 < < PITCHSHIFT ;
2004-08-23 00:15:46 +00:00
2016-01-18 05:22:07 +00:00
VectorClear ( chan - > origin ) ;
2005-06-14 04:52:10 +00:00
2016-01-18 05:22:07 +00:00
vol = ambient_level . value * ambientlevel [ i ] ;
2004-08-23 00:15:46 +00:00
if ( vol < 8 )
vol = 0 ;
2016-01-18 05:22:07 +00:00
oldvol = sc - > ambientlevels [ i ] ;
2010-12-05 02:46:07 +00:00
2004-08-23 00:15:46 +00:00
// don't adjust volume too fast
2016-01-18 05:22:07 +00:00
if ( sc - > ambientlevels [ i ] < vol )
2004-08-23 00:15:46 +00:00
{
2016-01-18 05:22:07 +00:00
sc - > ambientlevels [ i ] + = host_frametime * ambient_fade . value ;
if ( sc - > ambientlevels [ i ] > vol )
sc - > ambientlevels [ i ] = vol ;
2004-08-23 00:15:46 +00:00
}
else if ( chan - > master_vol > vol )
{
2016-01-18 05:22:07 +00:00
sc - > ambientlevels [ i ] - = host_frametime * ambient_fade . value ;
if ( sc - > ambientlevels [ i ] < vol )
sc - > ambientlevels [ i ] = vol ;
2004-08-23 00:15:46 +00:00
}
2005-06-14 04:52:10 +00:00
2016-01-18 05:22:07 +00:00
chan - > master_vol = sc - > ambientlevels [ i ] ;
2013-05-31 01:16:07 +00:00
chan - > vol [ 0 ] = chan - > vol [ 1 ] = chan - > vol [ 2 ] = chan - > vol [ 3 ] = chan - > vol [ 4 ] = chan - > vol [ 5 ] = bound ( 0 , chan - > master_vol * ( volume . value * voicevolumemod ) , 255 ) ;
2010-12-05 02:46:07 +00:00
if ( sc - > ChannelUpdate )
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
sc - > ChannelUpdate ( sc , chan , ( ( oldvol = = 0 ) ^ ( sc - > ambientlevels [ i ] = = 0 ) ) ? CUR_EVERYTHING : CUR_SPACIALISEONLY ) ;
2004-08-23 00:15:46 +00:00
}
2017-01-13 00:39:50 +00:00
# endif
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
struct sndreverbproperties_s * reverbproperties ;
size_t numreverbproperties ;
qboolean S_UpdateReverb ( size_t slot , void * reverb , size_t reverbsize )
{
struct reverbproperties_s newprops ;
if ( slot > = 1024 )
return false ;
if ( slot > = numreverbproperties )
{
int slots = slot + 1 ;
void * n = BZ_Realloc ( reverbproperties , sizeof ( * reverbproperties ) * slots ) ;
if ( ! n )
return false ;
reverbproperties = n ;
memset ( reverbproperties + numreverbproperties , 0 , sizeof ( * reverbproperties ) * ( slots - numreverbproperties ) ) ;
numreverbproperties = slots ;
}
memset ( & newprops , 0 , sizeof ( newprops ) ) ;
if ( reverb )
{
//clamp the size for possible future extensibility
if ( reverbsize > sizeof ( newprops ) )
reverbsize = sizeof ( newprops ) ;
memcpy ( & newprops , reverb , reverbsize ) ;
}
if ( memcmp ( & newprops , & reverbproperties [ slot ] . props , sizeof ( newprops ) ) )
{
reverbproperties [ slot ] . props = newprops ;
reverbproperties [ slot ] . modificationcount + + ;
}
return true ;
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = =
S_Update
Called once each time through the main loop
= = = = = = = = = = = =
*/
2016-07-12 00:40:13 +00:00
void S_UpdateListener ( int seat , int entnum , vec3_t origin , vec3_t forward , vec3_t right , vec3_t up , size_t reverbtype , vec3_t velocity )
2004-08-23 00:15:46 +00:00
{
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
soundcardinfo_t * sc ;
2016-07-12 00:40:13 +00:00
listener [ seat ] . entnum = entnum ;
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
VectorCopy ( origin , listener [ seat ] . origin ) ;
VectorCopy ( forward , listener [ seat ] . forward ) ;
VectorCopy ( right , listener [ seat ] . right ) ;
VectorCopy ( up , listener [ seat ] . up ) ;
2016-07-12 00:40:13 +00:00
VectorCopy ( velocity , listener [ seat ] . velocity ) ;
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
for ( sc = sndcardinfo ; sc ; sc = sc - > next )
2016-07-12 00:40:13 +00:00
if ( sc - > SetEnvironmentReverb & & ( sc - > seat = = seat | | ( sc - > seat = = - 1 & & seat = = 0 ) ) )
sc - > SetEnvironmentReverb ( sc , reverbtype ) ;
2004-08-23 00:15:46 +00:00
}
2009-04-01 22:03:56 +00:00
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
void S_GetListenerInfo ( int seat , float * origin , float * forward , float * right , float * up )
2009-04-01 22:03:56 +00:00
{
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
VectorCopy ( listener [ seat ] . origin , origin ) ;
VectorCopy ( listener [ seat ] . forward , forward ) ;
VectorCopy ( listener [ seat ] . right , right ) ;
VectorCopy ( listener [ seat ] . up , up ) ;
2009-04-01 22:03:56 +00:00
}
2016-01-18 05:22:07 +00:00
static void S_Q2_AddEntitySounds ( soundcardinfo_t * sc )
{
vec3_t positions [ 2048 ] ;
int entnums [ countof ( positions ) ] ;
sfx_t * sounds [ countof ( positions ) ] ;
unsigned int count ;
unsigned int j ;
channel_t * c ;
# ifdef Q2CLIENT
if ( cls . protocol = = CP_QUAKE2 )
count = CLQ2_GatherSounds ( positions , entnums , sounds , countof ( sounds ) ) ;
else
2019-01-29 07:18:07 +00:00
# endif
2019-01-29 23:43:50 +00:00
# ifdef VM_CG
2022-05-28 17:58:27 +00:00
if ( cls . protocol = = CP_QUAKE3 & & q3 )
2022-03-08 05:31:34 +00:00
count = q3 - > cg . GatherLoopingSounds ( positions , entnums , sounds , countof ( sounds ) ) ;
2019-01-29 07:18:07 +00:00
else
2016-01-18 05:22:07 +00:00
# endif
return ;
while ( count - - > 0 )
{
sfx_t * sfx = sounds [ count ] ;
if ( ! sfx )
continue ;
if ( sfx - > loadstate = = SLS_NOTLOADED )
2018-09-23 19:35:24 +00:00
S_LoadSound ( sfx , true ) ;
2016-01-18 05:22:07 +00:00
if ( sfx - > loadstate ! = SLS_LOADED )
continue ; //not ready yet
if ( sc - > ChannelUpdate )
{
2021-11-14 00:34:59 +00:00
for ( c = NULL , j = DYNAMIC_FIRST ; j < sc - > total_chans ; j + + )
2016-01-18 05:22:07 +00:00
{
2018-10-17 00:43:04 +00:00
if ( sc - > channel [ j ] . entnum = = entnums [ count ] & & ! sc - > channel [ j ] . entchannel & & ( sc - > channel [ j ] . flags & CF_CLI_AUTOSOUND ) )
2016-01-18 05:22:07 +00:00
{
c = & sc - > channel [ j ] ;
break ;
}
}
}
else
{
2021-11-14 00:34:59 +00:00
for ( c = NULL , j = DYNAMIC_FIRST ; j < sc - > total_chans ; j + + )
2016-01-18 05:22:07 +00:00
{
2018-10-17 00:43:04 +00:00
if ( sc - > channel [ j ] . sfx = = sfx & & ( sc - > channel [ j ] . flags & CF_CLI_AUTOSOUND ) )
2016-01-18 05:22:07 +00:00
{
c = & sc - > channel [ j ] ;
break ;
}
}
}
if ( ! c )
{
c = SND_PickChannel ( sc , 0 , 0 ) ;
if ( ! c )
continue ;
2018-10-17 00:43:04 +00:00
c - > flags = CF_CLI_AUTOSOUND | CF_FORCELOOP ;
2016-01-18 05:22:07 +00:00
c - > entnum = sc - > ChannelUpdate ? entnums [ count ] : 0 ;
c - > entchannel = 0 ;
2019-07-19 02:13:19 +00:00
c - > dist_mult = 3 / snd_nominaldistance . value ;
2016-01-18 05:22:07 +00:00
c - > master_vol = 255 * 1 ;
c - > pos = 0 < < PITCHSHIFT ; //q2 does weird stuff with the pos. we just forceloop and detect when it became irrelevant. this is required for stream decoding or openal
c - > rate = 1 < < PITCHSHIFT ;
for ( j = 0 ; j < countof ( c - > vol ) ; j + + )
c - > vol [ j ] = 0 ;
c - > sfx = NULL ;
}
if ( sc - > ChannelUpdate )
{ //hardware mixing doesn't support merging
2019-01-29 07:18:07 +00:00
VectorCopy ( positions [ count ] , c - > origin ) ;
2016-01-18 05:22:07 +00:00
SND_Spatialize ( sc , c ) ;
2019-01-29 07:18:07 +00:00
if ( c - > sfx )
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
sc - > ChannelUpdate ( sc , c , CUR_SPACIALISEONLY ) ;
2016-01-18 05:22:07 +00:00
}
else
{ //merge with any other ents, if we can
for ( j = 0 ; j < = count ; j + + )
{
if ( sounds [ j ] = = sfx )
{
sounds [ j ] = NULL ;
SND_AccumulateSpacialization ( sc , c , positions [ j ] ) ;
}
}
}
if ( ! c - > sfx )
{
for ( j = 0 ; j < countof ( c - > vol ) ; j + + )
if ( c - > vol [ j ] )
break ;
if ( j = = countof ( c - > vol ) )
c - > sfx = NULL ; //err, never mind
else
{
c - > sfx = sfx ;
if ( sc - > ChannelUpdate )
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
sc - > ChannelUpdate ( sc , c , CUR_EVERYTHING ) ;
2016-01-18 05:22:07 +00:00
}
}
}
}
2012-02-27 12:23:15 +00:00
static void S_UpdateCard ( soundcardinfo_t * sc )
2004-08-23 00:15:46 +00:00
{
int i , j ;
channel_t * ch ;
channel_t * combine ;
2004-10-03 22:52:02 +00:00
if ( ! sound_started )
2004-08-23 00:15:46 +00:00
return ;
2004-10-03 22:52:02 +00:00
if ( ( snd_blocked > 0 ) )
{
if ( ! sc - > inactive_sound )
return ;
}
2005-06-14 04:52:10 +00:00
2010-03-14 14:35:56 +00:00
# ifdef AVAIL_OPENAL
2013-07-26 17:19:06 +00:00
if ( sc - > ListenerUpdate )
2010-03-14 14:35:56 +00:00
{
2016-07-12 00:40:13 +00:00
sc - > ListenerUpdate ( sc , listener [ sc - > seat ] . entnum , listener [ sc - > seat ] . origin , listener [ sc - > seat ] . forward , listener [ sc - > seat ] . right , listener [ sc - > seat ] . up , listener [ sc - > seat ] . velocity ) ;
2010-03-14 14:35:56 +00:00
}
# endif
2004-08-23 00:15:46 +00:00
// update general area ambient sound sources
S_UpdateAmbientSounds ( sc ) ;
combine = NULL ;
2005-06-14 04:52:10 +00:00
// update spatialization for static and dynamic sounds
2010-11-06 23:05:29 +00:00
ch = sc - > channel + DYNAMIC_FIRST ;
for ( i = DYNAMIC_FIRST ; i < sc - > total_chans ; i + + , ch + + )
2004-08-23 00:15:46 +00:00
{
if ( ! ch - > sfx )
continue ;
2018-10-17 00:43:04 +00:00
if ( ch - > flags & CF_CLI_AUTOSOUND )
2016-01-18 05:22:07 +00:00
{
if ( ! ch - > vol [ 0 ] & & ! ch - > vol [ 1 ] & & ! ch - > vol [ 2 ] & & ! ch - > vol [ 3 ] & & ! ch - > vol [ 4 ] & & ! ch - > vol [ 5 ] )
{
ch - > sfx = NULL ;
if ( sc - > ChannelUpdate )
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
sc - > ChannelUpdate ( sc , ch , CUR_EVERYTHING ) ;
2016-01-18 05:22:07 +00:00
}
ch - > vol [ 0 ] = ch - > vol [ 1 ] = ch - > vol [ 2 ] = ch - > vol [ 3 ] = ch - > vol [ 4 ] = ch - > vol [ 5 ] = 0 ;
continue ;
}
2004-08-23 00:15:46 +00:00
2015-08-02 19:08:36 +00:00
if ( sc - > ChannelUpdate )
{
2016-10-22 07:06:51 +00:00
if ( ch - > flags & CF_FOLLOW )
SND_Spatialize ( sc , ch ) ; //update it a little
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
sc - > ChannelUpdate ( sc , ch , CUR_SPACIALISEONLY ) ;
2015-08-02 19:08:36 +00:00
continue ;
}
2004-08-23 00:15:46 +00:00
SND_Spatialize ( sc , ch ) ; // respatialize channel
if ( ! ch - > vol [ 0 ] & & ! ch - > vol [ 1 ] & & ! ch - > vol [ 2 ] & & ! ch - > vol [ 3 ] & & ! ch - > vol [ 4 ] & & ! ch - > vol [ 5 ] )
continue ;
// try to combine static sounds with a previous channel of the same
// sound effect so we don't mix five torches every frame
2005-06-14 04:52:10 +00:00
2021-11-14 00:34:59 +00:00
if ( ch - > flags & CF_CLI_STATIC )
2004-08-23 00:15:46 +00:00
{
// see if it can just use the last one
if ( combine & & combine - > sfx = = ch - > sfx )
{
combine - > vol [ 0 ] + = ch - > vol [ 0 ] ;
combine - > vol [ 1 ] + = ch - > vol [ 1 ] ;
combine - > vol [ 2 ] + = ch - > vol [ 2 ] ;
combine - > vol [ 3 ] + = ch - > vol [ 3 ] ;
combine - > vol [ 4 ] + = ch - > vol [ 4 ] ;
combine - > vol [ 5 ] + = ch - > vol [ 5 ] ;
ch - > vol [ 0 ] = ch - > vol [ 1 ] = ch - > vol [ 2 ] = ch - > vol [ 3 ] = ch - > vol [ 4 ] = ch - > vol [ 5 ] = 0 ;
continue ;
}
// search for one
2010-11-06 23:05:29 +00:00
combine = sc - > channel + DYNAMIC_FIRST ;
for ( j = DYNAMIC_FIRST ; j < i ; j + + , combine + + )
2004-08-23 00:15:46 +00:00
if ( combine - > sfx = = ch - > sfx )
break ;
2005-06-14 04:52:10 +00:00
2004-08-23 00:15:46 +00:00
if ( j = = sc - > total_chans )
{
combine = NULL ;
}
else
{
if ( combine ! = ch )
{
combine - > vol [ 0 ] + = ch - > vol [ 0 ] ;
combine - > vol [ 1 ] + = ch - > vol [ 1 ] ;
combine - > vol [ 2 ] + = ch - > vol [ 2 ] ;
combine - > vol [ 3 ] + = ch - > vol [ 3 ] ;
combine - > vol [ 4 ] + = ch - > vol [ 4 ] ;
combine - > vol [ 5 ] + = ch - > vol [ 5 ] ;
ch - > vol [ 0 ] = ch - > vol [ 1 ] = ch - > vol [ 2 ] = ch - > vol [ 3 ] = ch - > vol [ 4 ] = ch - > vol [ 5 ] = 0 ;
}
continue ;
}
}
}
2016-01-18 05:22:07 +00:00
S_Q2_AddEntitySounds ( sc ) ;
2004-08-23 00:15:46 +00:00
//
// debugging output
//
2009-11-04 21:16:50 +00:00
if ( snd_show . ival )
2004-08-23 00:15:46 +00:00
{
2021-04-14 05:21:04 +00:00
struct listener_s * l ;
2016-07-12 00:40:13 +00:00
int active , mute ;
active = 0 ;
mute = 0 ;
2004-08-23 00:15:46 +00:00
ch = sc - > channel ;
for ( i = 0 ; i < sc - > total_chans ; i + + , ch + + )
2016-07-12 00:40:13 +00:00
{
2004-08-23 00:15:46 +00:00
if ( ch - > sfx & & ( ch - > vol [ 0 ] | | ch - > vol [ 1 ] ) )
{
2015-08-02 11:36:46 +00:00
if ( snd_show . ival > 1 )
2023-04-17 02:53:35 +00:00
Con_Printf ( " %i, %i/%i/%i/%i/%i/%i %s \n " , i , ch - > vol [ 0 ] , ch - > vol [ 1 ] , ch - > vol [ 2 ] , ch - > vol [ 3 ] , ch - > vol [ 4 ] , ch - > vol [ 5 ] , ch - > sfx - > name ) ;
2016-07-12 00:40:13 +00:00
active + + ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
else if ( ch - > sfx )
mute + + ;
}
2005-06-14 04:52:10 +00:00
2021-04-14 05:21:04 +00:00
if ( sc - > seat < 0 )
l = & listener [ 0 ] ;
else
l = & listener [ sc - > seat ] ;
Con_Printf ( " ----(%i+%i %s %i %.1f %.1f %.1f)---- \n " , active , mute , sc - > name , l - > entnum , l - > origin [ 0 ] , l - > origin [ 1 ] , l - > origin [ 2 ] ) ;
2004-08-23 00:15:46 +00:00
}
2017-05-23 07:03:07 +00:00
# ifdef HAVE_MIXER
2005-06-14 04:52:10 +00:00
// mix some sound
2012-02-27 12:23:15 +00:00
if ( sc - > selfpainting )
return ;
if ( snd_blocked > 0 )
{
if ( ! sc - > inactive_sound )
return ;
}
2004-08-23 00:15:46 +00:00
S_Update_ ( sc ) ;
2017-05-23 07:03:07 +00:00
# endif
2004-08-23 00:15:46 +00:00
}
2017-05-23 07:03:07 +00:00
# ifdef HAVE_MIXER
2017-05-23 07:48:45 +00:00
int S_GetMixerTime ( soundcardinfo_t * sc )
2004-08-23 00:15:46 +00:00
{
2005-06-14 04:52:10 +00:00
int samplepos ;
2004-08-23 00:15:46 +00:00
int fullsamples ;
2005-06-14 04:52:10 +00:00
2004-08-23 00:15:46 +00:00
fullsamples = sc - > sn . samples / sc - > sn . numchannels ;
// it is possible to miscount buffers if it has wrapped twice between
// calls to S_Update. Oh well.
2005-06-14 04:52:10 +00:00
samplepos = sc - > GetDMAPos ( sc ) ;
2004-08-23 00:15:46 +00:00
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 ( sc - > samplequeue > 0 )
samplepos - = sc - > samplequeue ;
2011-01-29 19:53:38 +00:00
if ( samplepos < 0 )
{
samplepos = 0 ;
}
2004-08-23 00:15:46 +00:00
if ( samplepos < sc - > oldsamplepos )
{
2015-03-03 00:14:43 +00:00
int bias ;
2004-08-23 00:15:46 +00:00
sc - > buffers + + ; // buffer wrapped
2005-06-14 04:52:10 +00:00
2004-08-23 00:15:46 +00:00
if ( sc - > paintedtime > 0x40000000 )
2015-03-03 00:14:43 +00:00
{
//when things get too large, we push everything back to prevent overflows
bias = sc - > paintedtime ;
bias - = bias % fullsamples ;
sc - > paintedtime - = bias ;
sc - > buffers - = bias / fullsamples ;
2004-08-23 00:15:46 +00:00
}
}
sc - > oldsamplepos = samplepos ;
2011-01-29 19:53:38 +00:00
return sc - > buffers * fullsamples + samplepos / sc - > sn . numchannels ;
2004-08-23 00:15:46 +00:00
}
2017-05-23 07:03:07 +00:00
# endif
2004-08-23 00:15:46 +00:00
2010-11-06 23:05:29 +00:00
void S_Update ( void )
{
soundcardinfo_t * sc ;
2023-04-17 02:53:35 +00:00
RSpeedMark ( ) ;
2012-02-27 12:23:15 +00:00
S_LockMixer ( ) ;
2010-11-06 23:05:29 +00:00
for ( sc = sndcardinfo ; sc ; sc = sc - > next )
S_UpdateCard ( sc ) ;
2012-02-27 12:23:15 +00:00
S_UnlockMixer ( ) ;
2023-04-17 02:53:35 +00:00
RSpeedEnd ( RSPEED_AUDIO ) ;
2010-11-06 23:05:29 +00:00
}
2004-08-23 00:15:46 +00:00
void S_ExtraUpdate ( void )
{
2017-05-23 07:03:07 +00:00
# ifdef HAVE_MIXER
2004-08-23 00:15:46 +00:00
soundcardinfo_t * sc ;
2017-05-23 07:03:07 +00:00
# endif
2004-08-23 00:15:46 +00:00
2005-02-06 02:47:36 +00:00
if ( ! sound_started )
return ;
2014-03-30 08:55:06 +00:00
# if defined(_WIN32) && !defined(WINRT)
2012-10-14 09:00:49 +00:00
INS_Accumulate ( ) ;
2004-08-23 00:15:46 +00:00
# endif
2017-05-23 07:03:07 +00:00
# ifdef HAVE_MIXER
2009-11-04 21:16:50 +00:00
if ( snd_noextraupdate . ival )
2004-08-23 00:15:46 +00:00
return ; // don't pollute timings
for ( sc = sndcardinfo ; sc ; sc = sc - > next )
2012-02-27 12:23:15 +00:00
{
if ( sc - > selfpainting )
continue ;
if ( snd_blocked > 0 )
{
if ( ! sc - > inactive_sound )
continue ;
}
2012-04-24 07:59:11 +00:00
S_LockMixer ( ) ;
2004-08-23 00:15:46 +00:00
S_Update_ ( sc ) ;
2012-04-24 07:59:11 +00:00
S_UnlockMixer ( ) ;
2012-02-27 12:23:15 +00:00
}
2017-05-23 07:03:07 +00:00
# endif
2004-08-23 00:15:46 +00:00
}
2017-05-23 07:03:07 +00:00
# ifdef HAVE_MIXER
2012-02-27 12:23:15 +00:00
static void S_Update_ ( soundcardinfo_t * sc )
2004-08-23 00:15:46 +00:00
{
2011-01-29 19:53:38 +00:00
int soundtime ; /*in pairs*/
2004-08-23 00:15:46 +00:00
unsigned endtime ;
int samps ;
2005-02-06 02:47:36 +00:00
2004-08-23 00:15:46 +00:00
// Updates DMA time
2014-08-15 02:20:41 +00:00
soundtime = S_GetMixerTime ( sc ) ;
2004-08-23 00:15:46 +00:00
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 ( sc - > samplequeue > 0 )
2004-08-23 00:15:46 +00:00
{
2011-01-29 19:53:38 +00:00
/*device uses a write-once queue*/
endtime = soundtime + sc - > samplequeue / sc - > sn . numchannels ;
soundtime = sc - > paintedtime ;
samps = sc - > samplequeue / sc - > sn . numchannels ;
2004-08-23 00:15:46 +00:00
}
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
else if ( sc - > samplequeue < 0 )
2016-07-12 00:40:13 +00:00
{ /*device is telling us the exact point that we should be mixing to*/
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
endtime = soundtime ;
soundtime = sc - > paintedtime ;
samps = sc - > sn . samples / sc - > sn . numchannels ;
}
2011-01-29 19:53:38 +00:00
else
{
/*device uses memory-mapped output*/
// check to make sure that we haven't overshot
if ( sc - > paintedtime < soundtime )
{
//Con_Printf ("S_Update_ : overflow\n");
sc - > paintedtime = soundtime ;
}
2004-08-23 00:15:46 +00:00
2011-01-29 19:53:38 +00:00
// mix ahead of current position
endtime = soundtime + ( int ) ( _snd_mixahead . value * sc - > sn . speed ) ;
samps = sc - > sn . samples / sc - > sn . numchannels ;
}
2004-08-23 00:15:46 +00:00
if ( endtime - soundtime > samps )
2011-01-29 19:53:38 +00:00
{
2004-08-23 00:15:46 +00:00
endtime = soundtime + samps ;
2011-01-29 19:53:38 +00:00
}
2004-08-23 00:15:46 +00:00
2011-01-29 19:53:38 +00:00
/*DirectSound may have killed us to give priority to another app, ask to restore it*/
2005-06-14 04:52:10 +00:00
if ( sc - > Restore )
sc - > Restore ( sc ) ;
2004-08-23 00:15:46 +00:00
S_PaintChannels ( sc , endtime ) ;
2011-01-29 19:53:38 +00:00
sc - > Submit ( sc , soundtime , endtime ) ;
2004-08-23 00:15:46 +00:00
}
2012-02-27 12:23:15 +00:00
/*
called periodically by dedicated mixer threads .
do any blocking calls AFTER this returns . note that this means you can ' t use the Submit / unlock method to submit blocking audio .
*/
void S_MixerThread ( soundcardinfo_t * sc )
{
S_LockMixer ( ) ;
S_Update_ ( sc ) ;
S_UnlockMixer ( ) ;
}
2017-05-23 07:03:07 +00:00
# endif
2012-02-27 12:23:15 +00:00
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
console functions
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
2019-02-20 17:21:10 +00:00
void S_Play_f ( void )
2016-01-18 05:22:07 +00:00
{ //plays a sound located around the player
2004-08-23 00:15:46 +00:00
int i ;
char name [ 256 ] ;
sfx_t * sfx ;
2019-02-20 17:21:10 +00:00
const char * cmdname = Cmd_Argv ( 0 ) ;
float vol , attenuation = 0 ;
unsigned int flags = CF_NOSPACIALISE ;
int entnum = 0 ;
float * origin = NULL ;
2005-06-14 04:52:10 +00:00
2019-02-20 17:21:10 +00:00
/* //Vanilla compat (breaks modern QW mods):
if ( ! strcmp ( cmdname , " play " ) )
2004-08-23 00:15:46 +00:00
{
2019-02-20 17:21:10 +00:00
flags = 0 ;
attenuation = 1 ;
origin = listener [ 0 ] . origin ;
entnum = listener [ 0 ] . entnum ;
2004-08-23 00:15:46 +00:00
}
2019-02-20 17:21:10 +00:00
*/
2005-06-14 04:52:10 +00:00
2004-08-23 00:15:46 +00:00
i = 1 ;
while ( i < Cmd_Argc ( ) )
{
if ( ! Q_strrchr ( Cmd_Argv ( i ) , ' . ' ) )
{
2018-08-04 19:00:19 +00:00
Q_strncpyz ( name , Cmd_Argv ( i ) , sizeof ( name ) - 4 ) ;
2004-08-23 00:15:46 +00:00
Q_strcat ( name , " .wav " ) ;
}
else
2018-08-04 19:00:19 +00:00
Q_strncpyz ( name , Cmd_Argv ( i ) , sizeof ( name ) ) ;
2019-02-20 17:21:10 +00:00
i + + ;
2004-08-23 00:15:46 +00:00
sfx = S_PrecacheSound ( name ) ;
2019-02-20 17:21:10 +00:00
if ( ! strcmp ( cmdname , " playvol " ) )
vol = Q_atof ( Cmd_Argv ( i + + ) ) ;
else
vol = 1.0 ;
S_StartSound ( entnum , 0 , sfx , origin , NULL , vol , attenuation , 0 , 0 , flags ) ;
2004-08-23 00:15:46 +00:00
}
}
2012-02-27 12:23:15 +00:00
void S_SoundList_f ( void )
2004-08-23 00:15:46 +00:00
{
int i ;
sfx_t * sfx ;
sfxcache_t * sc ;
2012-10-08 04:36:10 +00:00
sfxcache_t scachebuf ;
2004-08-23 00:15:46 +00:00
int size , total ;
2012-10-08 04:36:10 +00:00
int duration ;
S_LockMixer ( ) ;
2004-08-23 00:15:46 +00:00
total = 0 ;
for ( sfx = known_sfx , i = 0 ; i < num_sfx ; i + + , sfx + + )
{
2015-07-14 14:47:00 +00:00
if ( sfx - > loadstate ! = SLS_LOADED )
sc = NULL ;
else if ( sfx - > decoder . decodedata )
2012-02-27 12:23:15 +00:00
{
2015-07-14 14:47:00 +00:00
if ( sfx - > decoder . querydata )
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
sc = ( sfx - > decoder . querydata ( sfx , & scachebuf , NULL , 0 ) < 0 ) ? NULL : & scachebuf ;
2015-07-14 14:47:00 +00:00
else
sc = NULL ; //don't bother trying to actually decode anything here.
2012-10-08 04:36:10 +00:00
if ( ! sc )
{
Con_Printf ( " S( ) : %s \n " , sfx - > name ) ;
continue ;
}
2012-02-27 12:23:15 +00:00
}
2012-10-08 04:36:10 +00:00
else
sc = sfx - > decoder . buf ;
2004-08-23 00:15:46 +00:00
if ( ! sc )
2012-10-08 04:36:10 +00:00
{
Con_Printf ( " ?( ) : %s \n " , sfx - > name ) ;
2004-08-23 00:15:46 +00:00
continue ;
2012-10-08 04:36:10 +00:00
}
2020-04-29 10:43:22 +00:00
size = ( sc - > soundoffset + sc - > length ) * QAF_BYTES ( sc - > format ) * ( sc - > numchannels ) ;
2012-10-08 04:36:10 +00:00
duration = ( sc - > soundoffset + sc - > length ) / sc - > speed ;
2004-08-23 00:15:46 +00:00
total + = size ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
if ( sfx - > loopstart > = 0 )
2004-08-23 00:15:46 +00:00
Con_Printf ( " L " ) ;
else
Con_Printf ( " " ) ;
2020-04-29 10:43:22 +00:00
Con_Printf ( " (%2db%2ic) %6i %2is : %s \n " , QAF_BYTES ( sc - > format ) * 8 , sc - > numchannels , size , duration , sfx - > name ) ;
2004-08-23 00:15:46 +00:00
}
Con_Printf ( " Total resident: %i \n " , total ) ;
2012-10-08 04:36:10 +00:00
S_UnlockMixer ( ) ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
void S_LocalSound2 ( const char * sound , int channel , float volume )
2004-08-23 00:15:46 +00:00
{
sfx_t * sfx ;
2009-11-04 21:16:50 +00:00
if ( nosound . ival )
2004-08-23 00:15:46 +00:00
return ;
if ( ! sound_started )
return ;
sfx = S_PrecacheSound ( sound ) ;
if ( ! sfx )
{
Con_Printf ( " S_LocalSound: can't cache %s \n " , sound ) ;
return ;
}
2018-10-17 00:43:04 +00:00
S_StartSound ( 0 , channel , sfx , NULL , NULL , volume , 0 , 0 , 0 , CF_CLI_INACTIVE | CF_NOSPACIALISE | CF_NOREVERB ) ;
2016-07-12 00:40:13 +00:00
}
void S_LocalSound ( const char * sound )
{
S_LocalSound2 ( sound , 256 , 1 ) ;
2004-08-23 00:15:46 +00:00
}
typedef struct {
2012-02-27 12:23:15 +00:00
sfxdecode_t decoder ;
2004-08-23 00:15:46 +00:00
qboolean inuse ;
int id ;
2020-01-09 15:35:40 +00:00
sfx_t * sfx ;
2012-02-27 12:23:15 +00:00
int numchannels ;
2020-04-29 10:43:22 +00:00
qaudiofmt_t format ;
2012-02-27 12:23:15 +00:00
int length ;
void * data ;
2004-08-23 00:15:46 +00:00
} streaming_t ;
# define MAX_RAW_SOURCES (MAX_CLIENTS+1)
streaming_t s_streamers [ MAX_RAW_SOURCES ] ;
2005-07-14 01:57:34 +00:00
void S_ClearRaw ( void )
{
memset ( s_streamers , 0 , sizeof ( s_streamers ) ) ;
}
2012-02-27 12:23:15 +00:00
//returns an sfxcache_t stating where the data is
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
sfxcache_t * QDECL S_Raw_Locate ( sfx_t * sfx , sfxcache_t * buf , ssamplepos_t start , int length )
2012-02-27 12:23:15 +00:00
{
streaming_t * s = sfx - > decoder . buf ;
if ( buf )
{
buf - > data = s - > data ;
buf - > length = s - > length ;
buf - > numchannels = s - > numchannels ;
buf - > soundoffset = 0 ;
buf - > speed = snd_speed ;
2020-04-29 10:43:22 +00:00
buf - > format = s - > format ;
2012-02-27 12:23:15 +00:00
}
2020-01-09 15:35:40 +00:00
if ( start > = s - > length )
return NULL ; //eof...
2012-02-27 12:23:15 +00:00
return buf ;
}
2020-01-09 15:35:40 +00:00
void QDECL S_Raw_Ended ( sfx_t * sfx )
{ //no longer playing anywhere...
streaming_t * s = sfx - > decoder . buf ;
s - > inuse = false ; //let it get reused now.
}
void QDECL S_Raw_Purge ( sfx_t * sfx )
{ //flush all caches, will be re-read from disk (or not, because this is streamed)
streaming_t * s = sfx - > decoder . buf ;
s - > length = 0 ;
s - > numchannels = 0 ;
BZ_Free ( s - > data ) ;
s - > data = NULL ;
s - > inuse = false ;
memset ( & sfx - > decoder , 0 , sizeof ( sfx - > decoder ) ) ;
}
2012-02-27 12:23:15 +00:00
2004-08-23 00:15:46 +00:00
//streaming audio. //this is useful when there is one source, and the sound is to be played with no attenuation
2020-04-29 10:43:22 +00:00
void S_RawAudio ( int sourceid , qbyte * data , int speed , int samples , int channels , qaudiofmt_t format , float volume )
2004-08-23 00:15:46 +00:00
{
soundcardinfo_t * si ;
int i ;
2014-02-07 08:38:40 +00:00
int prepadl ; //this is the amount of data that was previously available, and will be removed from the buffer.
int spare ; //the amount of existing data that is still left to be played
int outsamples ; //the amount of data we're going to add (at the output rate)
2006-06-04 01:43:52 +00:00
double speedfactor ;
2012-02-27 12:23:15 +00:00
qbyte * newcache ;
2004-08-23 00:15:46 +00:00
streaming_t * s , * free = NULL ;
2019-09-04 07:59:40 +00:00
2020-02-11 18:06:10 +00:00
if ( ! sound_started )
return ;
2004-08-23 00:15:46 +00:00
for ( s = s_streamers , i = 0 ; i < MAX_RAW_SOURCES ; i + + , s + + )
{
if ( ! s - > inuse )
{
2010-11-15 02:40:31 +00:00
if ( ! free )
free = s ;
2004-08-23 00:15:46 +00:00
continue ;
}
if ( s - > id = = sourceid )
break ;
}
2005-07-14 01:57:34 +00:00
if ( ! data )
{
if ( i = = MAX_RAW_SOURCES )
return ; //wierd, it wasn't even playing.
s - > inuse = false ;
2012-02-27 12:23:15 +00:00
S_LockMixer ( ) ;
2005-07-14 01:57:34 +00:00
for ( si = sndcardinfo ; si ; si = si - > next )
2010-11-13 17:22:46 +00:00
for ( i = 0 ; i < si - > total_chans ; i + + )
2020-01-09 15:35:40 +00:00
if ( si - > channel [ i ] . sfx = = s - > sfx )
2005-07-14 01:57:34 +00:00
{
si - > channel [ i ] . sfx = NULL ;
break ;
}
2012-02-27 12:23:15 +00:00
BZ_Free ( s - > data ) ;
2020-01-09 15:35:40 +00:00
s - > data = NULL ;
2012-02-27 12:23:15 +00:00
S_UnlockMixer ( ) ;
2005-07-14 01:57:34 +00:00
return ;
}
2012-02-27 12:23:15 +00:00
if ( i = = MAX_RAW_SOURCES | | ! s - > inuse ) //whoops.
2004-08-23 00:15:46 +00:00
{
2012-02-27 12:23:15 +00:00
if ( i = = MAX_RAW_SOURCES )
2004-08-23 00:15:46 +00:00
{
2012-02-27 12:23:15 +00:00
if ( ! free )
{
Con_Printf ( " No free audio streams \n " ) ;
return ;
}
s = free ;
2004-08-23 00:15:46 +00:00
}
2020-01-09 15:35:40 +00:00
if ( ! s - > sfx )
s - > sfx = S_FindName ( va ( " ***stream_%i*** " , i ) , true , false ) ;
s - > sfx - > decoder . buf = s ;
s - > sfx - > decoder . decodedata = S_Raw_Locate ;
s - > sfx - > decoder . ended = S_Raw_Ended ;
s - > sfx - > decoder . purge = S_Raw_Purge ;
s - > sfx - > loopstart = - 1 ; //non-looping...
s - > sfx - > loadstate = SLS_LOADED ;
2012-02-27 12:23:15 +00:00
s - > numchannels = channels ;
2020-04-29 10:43:22 +00:00
s - > format = format ;
2012-02-27 12:23:15 +00:00
s - > data = NULL ;
s - > length = 0 ;
s - > id = sourceid ;
s - > inuse = true ;
2005-07-14 01:57:34 +00:00
// Con_Printf("Added new raw stream\n");
2004-08-23 00:15:46 +00:00
}
2012-02-27 12:23:15 +00:00
S_LockMixer ( ) ;
2020-04-29 10:43:22 +00:00
if ( s - > format ! = format | | s - > numchannels ! = channels )
2004-08-23 00:15:46 +00:00
{
2020-04-29 10:43:22 +00:00
s - > format = format ;
2012-02-27 12:23:15 +00:00
s - > numchannels = channels ;
s - > length = 0 ;
2014-02-07 08:38:40 +00:00
Con_Printf ( " Restarting raw stream \n " ) ;
2004-08-23 00:15:46 +00:00
}
2006-06-04 16:02:03 +00:00
speedfactor = ( double ) speed / snd_speed ;
2005-08-12 19:37:24 +00:00
outsamples = samples / speedfactor ;
2005-07-14 01:57:34 +00:00
prepadl = 0x7fffffff ;
2004-08-23 00:15:46 +00:00
for ( si = sndcardinfo ; si ; si = si - > next ) //make sure all cards are playing, and that we still get a prepad if just one is.
{
2006-05-28 21:56:04 +00:00
for ( i = 0 ; i < si - > total_chans ; i + + )
2020-01-09 15:35:40 +00:00
if ( si - > channel [ i ] . sfx = = s - > sfx )
2004-08-23 00:15:46 +00:00
{
2010-11-20 22:01:16 +00:00
if ( prepadl > ( si - > channel [ i ] . pos > > PITCHSHIFT ) )
prepadl = ( si - > channel [ i ] . pos > > PITCHSHIFT ) ;
2004-08-23 00:15:46 +00:00
break ;
}
}
2005-07-14 01:57:34 +00:00
if ( prepadl = = 0x7fffffff )
2004-08-23 00:15:46 +00:00
{
2009-11-04 21:16:50 +00:00
if ( snd_show . ival )
2005-07-14 01:57:34 +00:00
Con_Printf ( " Wasn't playing \n " ) ;
2004-08-23 00:15:46 +00:00
prepadl = 0 ;
2010-11-20 22:01:16 +00:00
spare = 0 ;
2004-08-23 00:15:46 +00:00
if ( spare > snd_speed )
2005-07-14 01:57:34 +00:00
{
2006-03-11 03:12:10 +00:00
Con_DPrintf ( " Sacrificed raw sound stream \n " ) ;
2004-08-23 00:15:46 +00:00
spare = 0 ; //too far out. sacrifice it all
2005-07-14 01:57:34 +00:00
}
2004-08-23 00:15:46 +00:00
}
else
{
2010-11-20 22:01:16 +00:00
if ( prepadl < 0 )
prepadl = 0 ;
2012-02-27 12:23:15 +00:00
spare = s - > length - prepadl ;
2005-07-14 01:57:34 +00:00
if ( spare < 0 ) //remaining samples since last time
2004-08-23 00:15:46 +00:00
spare = 0 ;
2005-07-14 01:57:34 +00:00
2014-02-07 08:38:40 +00:00
if ( spare > snd_speed * 2 ) // more than 2 seconds of sound. don't buffer more than 2 seconds. 1: its probably buggy if we need to. 2: takes too much memory, and we use malloc+copies.
2005-07-14 01:57:34 +00:00
{
2006-03-11 03:12:10 +00:00
Con_DPrintf ( " Sacrificed raw sound stream \n " ) ;
2005-07-14 01:57:34 +00:00
spare = 0 ; //too far out. sacrifice it all
}
2004-08-23 00:15:46 +00:00
}
2020-04-29 10:43:22 +00:00
newcache = BZ_Malloc ( ( spare + outsamples ) * ( s - > numchannels ) * QAF_BYTES ( s - > format ) ) ;
memcpy ( newcache , ( qbyte * ) s - > data + prepadl * ( s - > numchannels ) * QAF_BYTES ( s - > format ) , spare * ( s - > numchannels ) * QAF_BYTES ( s - > format ) ) ;
2004-08-23 00:15:46 +00:00
2012-02-27 12:23:15 +00:00
BZ_Free ( s - > data ) ;
s - > data = newcache ;
2004-08-23 00:15:46 +00:00
2012-02-27 12:23:15 +00:00
s - > length = spare + outsamples ;
2004-08-23 00:15:46 +00:00
{
2006-06-04 01:43:52 +00:00
extern cvar_t snd_linearresample_stream ;
2020-04-29 10:43:22 +00:00
short * outpos = ( short * ) ( ( char * ) s - > data + spare * ( s - > numchannels ) * QAF_BYTES ( s - > format ) ) ;
2010-11-24 02:54:28 +00:00
SND_ResampleStream ( data ,
speed ,
2020-04-29 10:43:22 +00:00
format ,
2006-06-04 01:43:52 +00:00
channels ,
samples ,
2010-11-24 02:54:28 +00:00
outpos ,
snd_speed ,
2020-04-29 10:43:22 +00:00
s - > format ,
2012-02-27 12:23:15 +00:00
s - > numchannels ,
2009-11-04 21:16:50 +00:00
snd_linearresample_stream . ival ) ;
2004-08-23 00:15:46 +00:00
}
for ( si = sndcardinfo ; si ; si = si - > next )
{
2006-05-28 21:56:04 +00:00
for ( i = 0 ; i < si - > total_chans ; i + + )
2020-01-09 15:35:40 +00:00
if ( si - > channel [ i ] . sfx = = s - > sfx )
2004-08-23 00:15:46 +00:00
{
2010-11-06 23:05:29 +00:00
si - > channel [ i ] . pos - = prepadl * si - > channel [ i ] . rate ;
2005-07-14 01:57:34 +00:00
2012-02-27 12:23:15 +00:00
if ( si - > channel [ i ] . pos < 0 )
2005-07-14 01:57:34 +00:00
si - > channel [ i ] . pos = 0 ;
2013-08-21 07:14:39 +00:00
si - > channel [ i ] . master_vol = 255 * volume ;
2013-07-26 17:19:06 +00:00
if ( si - > ChannelUpdate )
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
si - > ChannelUpdate ( si , & si - > channel [ i ] , CUR_SPACIALISEONLY ) ;
2004-08-23 00:15:46 +00:00
break ;
}
2006-05-28 21:56:04 +00:00
if ( i = = si - > total_chans ) //this one wasn't playing.
2005-07-14 01:57:34 +00:00
{
2012-02-27 12:23:15 +00:00
channel_t * c = SND_PickChannel ( si , - 1 , 0 ) ;
2013-08-06 10:48:51 +00:00
if ( c )
{
2018-10-17 00:43:04 +00:00
c - > flags = ( sourceid > = 0 ? CF_CLI_INACTIVE : 0 ) | CF_CL_ABSVOLUME | CF_NOSPACIALISE ;
2016-01-18 05:22:07 +00:00
c - > entnum = 0 ;
2013-08-06 10:48:51 +00:00
c - > entchannel = 0 ;
c - > dist_mult = 0 ;
c - > master_vol = 255 * volume ;
c - > pos = 0 ;
c - > rate = 1 < < PITCHSHIFT ;
2020-01-09 15:35:40 +00:00
c - > sfx = s - > sfx ;
2013-08-06 10:48:51 +00:00
SND_Spatialize ( si , c ) ;
if ( si - > ChannelUpdate )
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
si - > ChannelUpdate ( si , c , CUR_EVERYTHING ) ;
2013-08-06 10:48:51 +00:00
}
2005-07-14 01:57:34 +00:00
}
2004-08-23 00:15:46 +00:00
}
2012-02-27 12:23:15 +00:00
S_UnlockMixer ( ) ;
2004-08-23 00:15:46 +00:00
}