Commit Graph

1965 Commits

Author SHA1 Message Date
Bill Currie 918d648053 [client] Fix sbar hud resizing with window size
hud_view has an extra layer that hid its missing resize_x
2022-09-22 01:40:30 +09:00
Bill Currie 4578b1af0d [vid] Remove console view from viddef_t
This breaks console scaling for now (con_width and con_height are gone),
but is a major step towards window resize support as console stuff
should never have been in viddef_t in the first place.

The client screen init code now sets up a screen view (actually the
renderer's scr_view) that is passed to the client console so it can know
the size of the screen. The same view is used by the status bar code.

Also, the ram/cache/paused icon drawing is moved into the client screen
update code. A bit of duplication, but I do plan on merging that
eventually.
2022-09-21 17:31:18 +09:00
Bill Currie 2c8bec27c7 Fix a pile of warnings for gcc 12
Most were pretty easy and fairly logical, but gib's regex was a bit of a
pain until I figured out the real problem was the conditional
assignments.

However, libs/gamecode/test/test-conv4 fails when optimizing due to gcc
using vcvttps2dq (which is nice, actually) for vector forms, but not the
single equivalent other times. I haven't decided what to do with the
test (I might abandon it as it does seem to be UD).
2022-07-31 17:13:26 +09:00
Bill Currie 94db9c8ab1 [quakefs] Add a data parameter to gamedir callbacks
While this didn't fix the problem for which I needed the data pointer,
having data pointers in callbacks is far too useful to throw out the
change.
2022-06-04 16:06:04 +09:00
Bill Currie 5b38117689 [sound] Make all volumes 0-1 (float) instead of 0-255 (int)
The scaling up of the volumes when setting a channel's volume bothered
me. The biggest issue being it hasn't been necessary for over a decade
since the conversion to a float-mixer. Now the volume and attenuation
scaling from protocol bytes is entirely in the client's hands.
2022-06-03 16:54:57 +09:00
Bill Currie e1a0bde5ee [sound] Remove a pile of unwanted sound.h includes
This does mean that the gl and sw renderers can no longer call
S_ExtraUpdate, but really, they shouldn't be anyway. And I seem to
remember it not really helping (been way too long since quake ran that
slowly for me).
2022-06-03 15:43:53 +09:00
Bill Currie f65a35da88 [gib] Clean up some header dependencies 2022-05-26 16:13:09 +09:00
Bill Currie c86cb0ac54 [renderer] Clean up some unwanted dependencies
Nothing outside of the renderer should be including d_iface.h (locs.c
does still for particle defines), and plugin/vid_render.h is more
independent.
2022-05-26 14:41:08 +09:00
Bill Currie 7240d2dc80 [model] Move plane info into mnode_t, and visframe out
The main goal was to get visframe out of mnode_t to make it thread-safe
(each thread can have its own visframe array), but moving the plane info
into mnode_t made for better data access patters when traversing the bsp
tree as the plane is right there with the child indices. Nicely, the
size of mnode_t is the same as before (64 bytes due to alignment), with
4 bytes wasted.

Performance-wise, there seems to be very little difference. Maybe
slightly slower.

The unfortunate thing about the change is the plane distance is negated,
possibly leading to some confusion, particularly since the box and
sphere culling functions were affected. However, this is so point-plane
distance calculations can be done with a single 4d dot product.
2022-05-22 12:41:23 +09:00
Bill Currie 925300716b [mode] Go back to using dclipnode_t everywhere
It was added only because FitzQuake used it in its pre-bsp2 large-map
support. That support has been hidden in bspfile.c for some time now.
This doesn't gain much other than having one less type to worry about.

Well tested on Conflagrant Rodent (the map that caused the need for
mclipnode_t in the first place).
2022-05-19 15:16:53 +09:00
Bill Currie bc82241e1c [client] Pre-cache temp entity data after clearing memory
This is a particularly ancient bug, sort of introduced by rhamph when he
optimized temp entity model handling and later exacerbated by me.
However, I suspect the actual problem is limited to nq as qw's gamedir
handling would have caused the models to be reloaded, but nq doesn't
ever change game directories once running.
2022-05-19 13:26:45 +09:00
Bill Currie a2d50395d6 [qw] Correct client shutdown order
This is similar to the change in nq (and for the same reason), making
sure that client shutdown (and thus config writing) happens before input
system shutdown.
2022-05-18 09:46:05 +09:00
Bill Currie 4562e1ea6c [qw] Plug a pile of memory leaks.
Whee.
2022-05-12 19:58:18 +09:00
Bill Currie 978d0306c0 [hash] Rename the publicly visible hashlink_t to hashctx_t
I think my biggest problem with the hashlink freelist parameter was how
much implementation it exposed in just the name.
2022-05-12 18:02:01 +09:00
Bill Currie ad8599574a [qw] Use SCR_NewScene instead of R_ClearState
This is the same issue as in nq, but I'd entirely forgotten to do qw. I
imagine similar segfaults would have occurred.
2022-05-11 14:47:01 +09:00
Bill Currie e9ad7b748b [renderer] Use scene_t to set the model data
This replaces *_NewMap with *_NewScene and adds SCR_NewScene to handle
loading a new map (for quake) in the renderer, and will eventually be
how any new scene is loaded.
2022-05-05 14:46:02 +09:00
Bill Currie e1f4df27c3 [qw] Fix inverted chat mode
This has been bugging me for a while whenever I tested qw. Just a silly
logic error. The whole system needs work, though.
2022-05-04 23:53:54 +09:00
Bill Currie 618453629f [qw] Call SV_Physics_Init_Cvars during server init
This fixes the broken physics. Really, not that bad considering how
extensive the cvar revamp was.
2022-05-04 23:16:12 +09:00
Bill Currie 675c82b47b [nq,qw] Do a little more diff reduction on sbar.c
It's rather difficult due to hipnotic and roque in nq, but still,
progress is progress.
2022-05-04 21:03:34 +09:00
Bill Currie 6d62e91ce7 [gamecode] Clean up progs data access
pr_type_t now contains only the one "value" field, and all the access
macros now use their PACKED variant for base access, making access to
larger types more consistent with the smaller types.
2022-04-29 16:59:15 +09:00
Bill Currie df4116a55d [qw] Add a FIXE for rcon_password 2022-04-24 21:13:46 +09:00
Bill Currie bff0847761 [cvar] Clean up most misinterpreted cvar types
The misinterpretations were due to either the cvar not being accessed
directly by the engine, but via only the callback, or the cvars were
accesssed only by progs (in which case, they should be float). The
remainder are a potential enum (hud gravity) and a "too hard basket"
(rcon password: need to figure out how I want to handle secret strings).
2022-04-24 20:04:06 +09:00
Bill Currie 12c84046f3 [cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.

As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.

The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).

While not used yet (partly due to working out the design), cvars can
have a validation function.

Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.

nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-24 19:15:22 +09:00
Bill Currie 001b3eb908 Fix some inconsistent cvar uses
Surprisingly, only two, but they were caught by the different value
fields being used, thus the cvar was checked in multiple places. I
imagine that's not really all that common, so there may be some
inconsistencies between default value and use.
2022-04-24 17:23:46 +09:00
Bill Currie 55f7886607 Remove some long dead cvars
The declarations were still around, but the creation and code using them
was removed long ago.
2022-04-24 17:23:46 +09:00
Bill Currie d987cef32e [qw] Fix an extern in a C file
Rather worrying finding one. I guess I didn't feel like finding a header
for the declaration at time time.
2022-04-24 17:23:46 +09:00
Bill Currie ddfacf61ee [qw] Get remote screen shots working again
Probably better than they ever have, really, since I think they were
broken for one renderer or another.
2022-04-01 02:04:24 +09:00
Bill Currie 0880fab909 [nq,qw] Get demo capture working again
It turns it it had been broken for some time: it was attempting to write
the files to the wrong place.
2022-04-01 01:01:53 +09:00
Bill Currie acffacc59b [renderer] Make screen capture support asynchronous operation
This fixes (*ahem*) the vulkan renderer segfaulting when attempting to
take a screenshot. However, the image is upside down. Also, remote
snapshots and demo capture are broken for the moment.
2022-04-01 01:01:53 +09:00
Bill Currie a29836cc2c [quakefs] Return QFile pointer from QFS_NextFile(name)
QFS_NextFilename was renamed to QFS_NextFile to reflect the fact it now
returns a QFile pointer for the newly created file (as well as the
name). This necessitated updating WritePNG to take a file pointer
instead of a file name, with the advantage that WritePNGqfs is no longer
necessary and callers have much more control over the creation of the
file.

This makes QFS_NextFile much more secure against file system race
conditions and attacks (at least in theory). If nothing else, it will
make it more robust in a multi-threaded environment.
2022-03-31 17:27:04 +09:00
Bill Currie aed5cdee8e [sbar] Disable some unused functions
I don't know why draw_altstring is there at all, but draw_nstring being
in nq is likely due to minimising the diffs between nq and qw.
2022-03-31 03:02:55 +09:00
Bill Currie 2abd4a5e79 [qw] Clean up some int-char warnings
More harmlessness, but no harm telling the compiler to sit in the
corner.
2022-03-31 03:00:24 +09:00
Bill Currie 0bb562f93f Fix a bunch of float vs int bugs
Just those made me glad I tried compiling with clang: running into those
bugs would have lead to some serious headaches, I imagine.
2022-03-31 00:28:26 +09:00
Bill Currie 38319d01b2 Fix some null pointer shenanigans
clang doesn't like anything but a bare 0 as null (and in some of the
cases, it was quite right: '\0' should not be treated as a null
pointer). And the crashers were just for paranoia and probably aren't
needed any more (kept for now, though).
2022-03-31 00:25:22 +09:00
Bill Currie db01650dac Update vec3_t/vec4f_t hacks to work with clang
Still work with gcc, of course, and I still need to fix them properly,
but now they're actually slightly easier to find as they all have vec_t
and FIXME on the same line.
2022-03-31 00:08:26 +09:00
Bill Currie da42aaf423 [sound] Use vec4f_t for api functions
Fixes a few vec3_t/vec4f_t FIXMEs.
2022-03-30 23:42:38 +09:00
Bill Currie 3c86764eb2 [scene] Move entity_t etc into scene headers
I meant to do this a while ago but forgot about it. Things are a bit of
a mess in that the renderer knows too much about entities, but
eventually the renderer will know about only things to render (meshes,
particles, etc).
2022-03-29 14:43:38 +09:00
Bill Currie 75d7f4cecb [renderer] Clean up particles a little
The quake-specific enums are now in the client header, and the particle
system now has a gravity field rather than getting it from
vid_render_data (which I hope to eventually get rid of entirely).
2022-03-29 14:43:38 +09:00
Bill Currie 0f30f0a133 [mathlib] Remove suspicious IS_NAN
The implementation looks wrong (more like infinity). Where it was used
is currently disabled, but the usages were replaced with C99's isnan.
2022-03-19 12:50:08 +09:00
Bill Currie c3f38e1c79 [renderer] Remove player_entity field
This was a hold-over from the gl mirror code.
2022-03-19 09:46:53 +09:00
Bill Currie ee51d06aa3 [renderer] Clean up a lot of recalc_refdef use
I think the widespread use of recalc_refdef (and force_fullscreen) was
the result of a rushed merge of the renderer and video code (I do seem
to remember sprinkling them around). This cleans the two out of the
client code.
2022-03-19 00:56:30 +09:00
Bill Currie ea2fd32228 [renderer] Merge screenshot code as much as possible
Only CaptureBGR is per-renderer as the rest of the screenshot code uses
it to do the actual capture (which is target dependent). Vulkan is
currently broken due to capture being an asynchronous process and the
rest of the code expecting capture to be synchronous (also, bgr vs rgb).

The best thing is all renderers now write the same format (currently
png).
2022-03-07 15:04:54 +09:00
Bill Currie 2eae2e5d74 [renderer] Move some functions from plugins to main lib
One step in cleaning up vid_render_funcs.
2022-03-07 13:40:04 +09:00
Bill Currie 1ea3a3807e [renderer] Clean up a pile of dead screen declarations
The declarations were either unused, or the functions empty stubs for
all renderers.
2022-03-06 13:47:41 +09:00
Bill Currie 45c3c6d7be [screen] Clean up some dead declarations 2022-03-05 14:35:56 +09:00
Bill Currie d69355f521 [renderer] Support multiple entity queues
While there's currently only the one still, this will allow the entities
to be multiply queued for multi-pass rendering (eg, shadows). As the
avoidance of putting an entity in the same queue more than once relies
on the entity id, all entities now come from the scene (which is stored
in cl_world in the client code for nq and qw), thus the extensive
changes in the clients.
2022-03-05 02:05:39 +09:00
Bill Currie 6573acbc74 [qw] Fix some segfaults in chase mode
And unconditionally allow chase cam when playing demos.
2022-03-05 01:14:43 +09:00
Bill Currie 43a329dcb5 [client] Get the basic chase camera working
The more advanced modes are rather broken (continuous spinning), but
they may have been for a while. The bulk of the various changes were due
to renaming viewstate's origin and angles to make their meaning more
explicit.
2022-03-01 11:43:23 +09:00
Bill Currie fb83d87a0e Fix some distcheck issues
Just keeping up with myself.
2022-03-01 10:12:50 +09:00
Bill Currie 57dd4494cc [renderer] Pass in a camera transform
More r_data cleanup. Things could be better still, but this is a start.
2022-02-28 16:59:38 +09:00