havoc [Sun, 26 May 2019 03:04:36 +0000 (03:04 +0000)]
UNMERGE! Implement SDL2 AUDIO_F32 format and use it as the default, since it has become the preferred format of more platforms these days, and SDL2 uses it internally.
Improved the fallback mechanism on SDL2 audio setup - by removing it; SDL2 will tell us what changes it makes for the format, and it will convert the rest automatically.
havoc [Sun, 26 May 2019 03:04:36 +0000 (03:04 +0000)]
Implement SDL2 AUDIO_F32 format and use it as the default, since it has become the preferred format of more platforms these days, and SDL2 uses it internally.
Improved the fallback mechanism on SDL2 audio setup - by removing it; SDL2 will tell us what changes it makes for the format, and it will convert the rest automatically.
cloudwalk [Mon, 25 May 2020 13:51:59 +0000 (13:51 +0000)]
Fix most Q3 & QL glow maps
From bones_was_here: "Very few glow maps work in unmodified Q3 maps as they do not use the _glow darkplaces convention, instead Q3 shaders specify the file name to use which is not currently supported.
Fortunately there is a naming convention started in id software's pak0 and continued in QL and most 3rd party maps. It uses these forms: foo_texture.blend.ext and bar_texture_blend.ext
It's not possible to fix 100% of glow maps without parsing Q3 shaders and using the specified file name, but this is a big improvement.
This also fixes a few glow maps in nexcompat, which are originally Q3 textures that were not renamed to _glow."
cloudwalk [Sun, 24 May 2020 14:18:15 +0000 (14:18 +0000)]
Fix FS_Seek for compressed file from PK3
From Slava: "Currently FS_Seek works incorrectly with compressed files from PK3 but this issue isn't noticed because in most cases engine is using FS_LoadFile which reads file sequentially without seeking."
divverent [Mon, 23 Mar 2020 20:37:56 +0000 (20:37 +0000)]
Fix the corona bug. The render bug only though.
This is done by reviving alphamod and colormod arguments of
RSurf_ActiveCustomEntity.
The current implementation is a bit rough and needlessly copies the
worldentity; the struct isn't huge though and it's only done when
actually colormodding (and thus only for coronas, r_editlights, a few
sprites and nomodels).
Refactored R_UpdateEntityLighting to CL_UpdateEntityShading, which sets fields like ent->render_modellight_ambient.
Added texture->render_modellight_ambient and similar fields which concretely define how the material is to be rendered, so all of the various tweaks and modifiers are no longer buried in R_SetupShader_Surface which has now been refactored heavily.
Removed R_LightPoint as it's really not necessary - this change will make lit particles a little bit slower as R_CompleteLightPoint is a slightly more expensive function.
Refactored R_CompleteLightPoint to have more consistent code, changed the final color math so that it passes q1bsp/q2bsp lighting through unmodified.
Changed shading of tag_entity attachments - they now use the root entity's origin for shading, this fixes r_shadows where the shadows could go in different directions on CSQC entities (r_shadows code already contained a hack to work around this problem for network entities).
Renamed r_refdef.lightmapintensity and ambient to r_refdef.scene.lightmapintensity and ambientintensity.
UNMERGE! Refactored R_UpdateEntityLighting to CL_UpdateEntityShading, which sets fields like ent->render_modellight_ambient.
Added texture->render_modellight_ambient and similar fields which concretely define how the material is to be rendered, so all of the various tweaks and modifiers are no longer buried in R_SetupShader_Surface which has now been refactored heavily.
Removed R_LightPoint as it's really not necessary - this change will make lit particles a little bit slower as R_CompleteLightPoint is a slightly more expensive function.
Refactored R_CompleteLightPoint to have more consistent code, changed the final color math so that it passes q1bsp/q2bsp lighting through unmodified.
Changed shading of tag_entity attachments - they now use the root entity's origin for shading, this fixes r_shadows where the shadows could go in different directions on CSQC entities (r_shadows code already contained a hack to work around this problem for network entities).
Renamed r_refdef.lightmapintensity and ambient to r_refdef.scene.lightmapintensity and ambientintensity.
divverent [Sun, 15 Mar 2020 01:45:25 +0000 (01:45 +0000)]
Add a Quake Live-style mouse acceleration mode.
Its cvars are m_accel_power*, and the cvar meanings are as close as possible
to the ezQuake implementation (as its source is available). Names differ though
due to conflicts with the current linear acceleration mode.
Original code by Frank <franparpe@franparpe.org>, cleanups by Rudolf Polzer <divVerent@xonotic.org>.
Change default value of r_shadows_shadowmapscale from 1 to 0.25, so that
shadows cover a larger part of the level around the eye.
Change the way r_shadows 2 size is calculated so that it uses 1/4th of
the texture atlas size (at default this would be 2048 of 8192) rather
than 2*r_shadow_shadowmapping_maxsize (at default that was 2*512 = 1024
of 8192).
Refactored R_UpdateEntityLighting to CL_UpdateEntityShading, which sets fields like ent->render_modellight_ambient.
Added texture->render_modellight_ambient and similar fields which concretely define how the material is to be rendered, so all of the various tweaks and modifiers are no longer buried in R_SetupShader_Surface which has now been refactored heavily.
Removed R_LightPoint as it's really not necessary - this change will make lit particles a little bit slower as R_CompleteLightPoint is a slightly more expensive function.
Refactored R_CompleteLightPoint to have more consistent code, changed the final color math so that it passes q1bsp/q2bsp lighting through unmodified.
Changed shading of tag_entity attachments - they now use the root entity's origin for shading, this fixes r_shadows where the shadows could go in different directions on CSQC entities (r_shadows code already contained a hack to work around this problem for network entities).
Renamed r_refdef.lightmapintensity and ambient to r_refdef.scene.lightmapintensity and ambientintensity.
Frank [Sun, 15 Mar 2020 01:43:41 +0000 (21:43 -0400)]
Add a Quake Live-style mouse acceleration mode.
Its cvars are m_accel_power*, and the cvar meanings are as close as possible
to the ezQuake implementation (as its source is available). Names differ though
due to conflicts with the current linear acceleration mode.
Original code by Frank <franparpe@franparpe.org>, cleanups by Rudolf Polzer <divVerent@xonotic.org>.
::stable-branch::merge=67692f92e177d44231df0d59833cee069e71eb9a
divverent [Sat, 22 Feb 2020 03:47:48 +0000 (03:47 +0000)]
Another flag bites the dust. This time: -ffinite-math-only.
Since GCC 5, with this flag set, NaN compares equal to zero in some cases but
not others. Causes e.g. "attempted division by zero" error spam from this QC
code:
float x = nan("");
if (x == 0) {
return 0;
}
return 1.0 / x;
Yes, those NaNs should not be happening in the first place, but suddenly
passing some but not all equality checks to zero seems rather dangerous.
Reference: issue #2412 (not a fix for it; the QC code has a problem too but
this change helps track it down properly).
After migrating to SDL2 interfaces there is noise during startup fix
this by initializng buffer as specification requires.
Per SDL_AudioCallback spec:
The callback must completely initialize the buffer; as of SDL 2.0, this buffer is not initialized before the callback is called. If there is nothing to play, the callback should fill the buffer with silence.
Make the semantics of CL_VM_UpdateView more clear - if CSQC is loaded, it is required to provide the CSQC_UpdateView function, and won't render a view if it does not call that, so we don't need to check its return value.
New alternative to fullbright: r_fullbright_directed.
Set this to 1, and anything EF_FULLBRIGHT or fullbright due to
r_fullbright or unlit map (but specifically not sprites and surfaces
with surfaceparm nolightmap) will have a directional effect applied to
them.
This mode is intended for testing maps in early development, and should
not be used for normal gameplay (although it should be rather harmless
there).
Manage resetting the key event state on video reinitialization centrally.
Fixes:
- No key state clear when SDL gets restarted.
- Key state clear was the wrong action - it allows all keys to get pressed
again, but does not actually release anything in cl_input.c, so e.g. +jump
binds stay pressed on vid_restart.
Only vid_wgl.c retains some vid-specific handling (reset of key state when
alt-tabbing out and back in) - there's a chance that we may need similar logic
in the other vid drivers; if so, it may be possible to do this in a shared
place too by watching for changes to vid_activewindow.
havoc [Sun, 25 Mar 2018 20:04:14 +0000 (20:04 +0000)]
Rewrote most of r_lightning.c, it now uses CL_MeshEntities in MESH_PARTICLES rather than its own rendering code.
Changed the texture generation so it is in the same orientation as the external texture to reduce some code duplication, and changed the look of it to more closely mimic the model-based lightning.
havoc [Sun, 25 Mar 2018 19:58:39 +0000 (19:58 +0000)]
Add CL_MeshEntities_*, every frame in the client all MESH_ entities are added to the frame if they have any surfaces - surfaces can be created with Mod_Mesh_AddSurface and friends. These entities have full material rendering support, which should allow reducing the number of special case renderable objects in the scene in future.
Add Mod_Mesh functions - these allow creation of dynamic mesh models.
Add Mod_LoadCustomMaterial which initializes a texture_t using a skinframe and some parameters, useful with Mod_Mesh and CL_MeshEntities.
havoc [Sat, 24 Mar 2018 21:35:50 +0000 (21:35 +0000)]
Change r_showbboxes to have outlined edges of the box, and the box is now rendered as doublesided which feels more consistent when moving in/out of large trigger boxes and similar.
Added r_showbboxes_client which shows bboxes of clientside qc entities.
havoc [Sat, 24 Mar 2018 21:34:21 +0000 (21:34 +0000)]
Add entity number to showtex overlay.
Add clientside qc entity support to showtex - trace is performed on client and server and the shorter one will be shown.
havoc [Sat, 24 Mar 2018 17:47:32 +0000 (17:47 +0000)]
Add skipmaterialflagsmask feature to TraceLine and friends - this allows more sensible skipping of non-occluders by material (MATERIALFLAGMASK_TRANSLUCENT is now useful).
Recreated TracePoint code from TraceLine code to make it set depth variables properly.
havoc [Sat, 17 Mar 2018 07:35:38 +0000 (07:35 +0000)]
Fix a bug with PRVM_64 where CSQC float stats were sent by aliasing to int64 and returning as int32, now correctly converts to float and then uses a union to get the int32 representation.
havoc [Sun, 11 Mar 2018 19:24:42 +0000 (19:24 +0000)]
Rework R_CanSeeBox a bit to support an eyejitter feature, and make it available throughout the renderer.
Make TraceLineOfSight check if the trace endpos is within a box, not just if fraction is 1 - this makes it much more likely to say an object is visible when the object overlaps walls and other obstacles as the rays only need to reach the box, it doesn't matter much where it goes inside the box.
havoc [Sun, 11 Mar 2018 19:08:41 +0000 (19:08 +0000)]
Change shadowless rtlights so that they are not occluded by anything - no pvs checks or portal culling.
This makes r_shadow_deferred 0 look the same as r_shadow_deferred 1 - lights fill their whole area if there are no shadows to block them.
This also fixes a popping issue with r_shadow_deferred 1 where the eye was not in a leaf the light considered to be visible, and thus the light was not drawn (which made quite a difference when you move back and forth between leafs that were and were not lit), since when it was drawn it lit everything in the area.
havoc [Sun, 11 Mar 2018 19:04:22 +0000 (19:04 +0000)]
Don't set MATERIALFLAG_NOSHADOW on SKY materials. They need to cast shadows to prevent issues in e1m7 and other cases where sky occludes light bleed into other areas.
But when loading Q1BSP, set MATERIALFLAG_NOSHADOW on SKY if it has non-SOLID contents behind it, this supports the e1m5 logo shadow trick.
havoc [Wed, 30 Aug 2017 04:29:14 +0000 (04:29 +0000)]
Fix GLSL shader to only specify invariant gl_Position on the vertex shader, not the fragment shader - woops, this is what I get for not testing that change.
havoc [Sun, 6 Aug 2017 15:33:55 +0000 (15:33 +0000)]
Use the invariant keyword on gl_Position on GLSL 1.20 or higher and GLSL ES
1.00 or higher, this should resolve zfighting between light polygons and
base surfaces.
A long long time ago this was using ftransform() which ensured invariance but use of the invariant keyword was not added when we switched away from that.
Thanks for the bug report:
https://www.reddit.com/r/quake/comments/6rwwm5/need_some_help_getting_quake_running_with/
SDL2: combine SDL_KEYDOWN events directly with following SDL_TEXTINPUT events when possible.
This solves ` keypresses that open/close the console also typing in a character
"once and for all". The ability to type the ` character into the console is not
impaired by this as con_closeontoggleconsole's logic to by default ignore the
toggleconsole key when in the console but not at the beginning of the line
still applies.
rcon server: add an explicit check against empty password, instead of assuming the calling code is correct.
This logic had a bug in the past that had been introduced by r8886 and
accidentally fixed when introducing multi-account support in r9420. The bug was
that rcon_password being empty led to the empty password being accepted in some
cases, as there was never any explicit logic to handle that in rcon - it was
more "accidentally" rejected by a packet formatting check which does not apply
to srcon as the empty password wouldn't be empty over the wire.
In other words: DP builds from [r8886, r9419] had a serious vulnerability and
the only workaround is to always have rcon_password set.
The check added here will complain and reject in case the calling code for some
reason no longer prevents empty passwords from being accepted.
Also adding comments to the new logic explaining how it prevents the empty
password from being accepted.
Fix a bug in collisions between brushes and brushes when the plane is rotating - this case is never used currently but it's definitely a bug worth fixing.
Fix bugs in ModList_RebuildList such that it no longer lists files in the quake directory as gamedirs.
These bugs were previously hidden by a different behavior in FS_CheckNastyPath until 20140716 where directories with a period in their name were skipped, but that was not a complete solution.
havoc [Sat, 14 Jan 2017 19:33:33 +0000 (19:33 +0000)]
added separate cl_nopred cvar to use when playing on qw servers since
players expect prediction in quakeworld, now cl_movement is only used on
dp6/dp7 servers.