Commit Graph

1222 Commits

Author SHA1 Message Date
Bill Currie bdbb8f1e0b [nq] Get intermission view working again
This is currently just the basic intermission view (not the finale view
or the deathmatch intermission view).
2022-11-03 17:49:05 +09:00
Bill Currie ea3ff47cc5 [nq] Make sbar setup more data-driven
I doubt the scheme is final (eg, char buffer setup), but it feels better
than a pile of function calls.
2022-11-03 15:53:52 +09:00
Bill Currie 82d407e3c2 [nq] Get hud time and fps displays working
This includes moving the related cvars from botn nq and qw into the
client hud code. In addition, the hud code supports update and
update-once function components. The update component is for updates
that occur every frame, but update-once components (not used yet) are
for one-shot updates (eg, when a value updates very infrequently).
2022-11-03 14:46:44 +09:00
Bill Currie 0626ec6469 [nq] Get scores display working again
Now only the time portion updates every frame, and then only when the
scores are shown (no real change for that one). Not really a significant
optimization, as the information was updated only while the scores were
shown, but it's still nice.
2022-11-03 11:38:32 +09:00
Bill Currie 4491ce213b [client] Merge cl_screen.c
The client state that was accessed by cl_screen is now put in viewstate
and maintained by the client before calling CL_UpdateScreen.
2022-11-02 15:11:09 +09:00
Bill Currie efee9c87a9 [nq,qw] Minimize differences in cl_screen.c 2022-11-01 21:00:40 +09:00
Bill Currie 036afba23d [ui] Propagate motion modifications for views
With this, the status bar now stays in the correct location as the
window is resized. Rather nice that it was just a simple omission.
2022-11-01 10:15:23 +09:00
Bill Currie 817aeb334e [ui] Convert view_t to an ECS entity
Much of the nq/qw HUD system is quite broken, but the basic status bar
seems to be working nicely. As is the console (both client and server).
Possibly the biggest benefit is separating the rendering of HUD elements
from the updating of them, and much less traversing of invisible views
whose only purpose is to control the positioning of the visible views.

The view flow tests are currently disabled until I adapt the flow code
to ECS.

There seems to be a problem with view resizing in that some gravities
don't follow resizing correctly.
2022-11-01 00:40:52 +09:00
Bill Currie db7f8a461e [ecs] Move ECS core into its own library
While the libraries are probably getting a little out of hand, the
separation into its own directory is probably a good thing as an ECS
should not be tied to scenes. This should make the ECS more generally
useful.
2022-10-26 17:24:03 +09:00
Bill Currie 9f9e21f1dc [nq] Relink entities when there model changes
This is the fix for the grenade explosion bug. It was rather difficult
to track down because *two* explosions are rendered for the one grenade
(but that's actually another bug due to the nq/qw merge). It's also
correct as changing the model can change the BSP leafs the entity
touches.
2022-10-23 23:02:16 +09:00
Bill Currie cf4a3399c4 [nq] Reduce entity churn
While chasing down the grenade explosion bug, I noticed that entities
were being created and destroyed (or really, not destroyed) just to
check of the entity was valid. In the old system, this wasn't
*horrible*, but with the ECS, it does mean entities and components are
getting churned up, which wouldn't be good for the entity generation
counter (only 12 bits).
2022-10-23 22:43:45 +09:00
Bill Currie 8acd5c558b [scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).

While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 22:24:36 +09:00
Bill Currie 2c9da25e17 Clean up some FIXMEs and XXXs
They seemed to be generally unnecessary. Also fixes some typos in
related comments.
2022-10-15 14:40:29 +09:00
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 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 6c33fbb850 [nq] Move usercmd_t to protocol.h
Removes the need for the server code to include client.h
2022-06-03 15:42:10 +09:00
Bill Currie e86e93551d [nq] Remove some more bandaids
More host cleanup. The client now processes input itself, as does the
server, but only if running a dedicated server. The server no longer
blocks sound when loading a map as it shouldn't know anything about
sound. This will probably need something done in the client, but moving
the server into a separate thread will have that effect anyway.
2022-05-26 17:10:23 +09:00
Bill Currie 521f805edf [nq] Move Host_ClientFrame to CL_Frame
This removes a bit of mess from sv_ded.c, and is a step towards making
host*.c just the minimal interface between client and local server.
2022-05-26 16:17:00 +09:00
Bill Currie f65a35da88 [gib] Clean up some header dependencies 2022-05-26 16:13:09 +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 cfe7064708 [nq] Update weapon model for SU_WEAPON2
This fixes the missing view weapon in vulkan and crashes in other
renderers when playing Conflagrant Rodent.
2022-05-19 13:26:19 +09:00
Bill Currie 7abdfc421e [nq] Enable blue and red lights for quad and invulnerability
I got tired of being disappointed that nq didn't have colored lights for
the power-ups (especially when I'd waste time thinking it was a bug).
The problem is that the server (progs code) specifies only DIMLIGHT (qw
adds in the colors). Another problem is that the server tells us only
our own stats, so the colors are disabled for multiplayer otherwise it
might be confusing.
2022-05-18 11:06:39 +09:00
Bill Currie 0b9d36b08d [nq] Fix some level change segfaults
I really need to play more while working on the code.

Anyway, ca_active works nicely for the status bar in general, and
CL_ClearMemory needs to be called before Host_ClearMemory when doing
single-player.
2022-05-17 10:28:57 +09:00
Bill Currie 1f811e6310 [nq] Fix a particularly nasty memory leak
Nasty because it was caused by spaghetti (normally, I like the stuff).
Drinking-age spaghetti at that. Nicely, this removes the need for one
function in sv_ded.c (which is what I think I was trying to achieve).
2022-05-12 22:49:48 +09:00
Bill Currie a17deb3ef2 [nq] Don't double-allocate timedemo data buffer
Looks like a copy/paste error (wild guess: got my fingers tangled in
vim).
2022-05-12 22:48:31 +09:00
Bill Currie aabf3e14f8 [model] Support freeing of skin data
I doubt it's enough, but it does seem to cover what's needed for glsl
(maybe not the actual textures, unsure there, but I think they're
recycled).
2022-05-12 22:46:31 +09:00
Bill Currie 4e526702dd [nq] Plug some memory leaks and fix a shutdown error
The error was introduced by the input memory leak fixes, but the
solution is to ensure CL_Shutdown is called before IN_Shutdown.

Some of the memory leaks were quite legitimate this time.
2022-05-12 20:58:39 +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 4515b0d7f0 [nq] Use SCR_NewScene in CL_SetState
This was missed when changing CL_ClearState. Fixes segfault on respawn.
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 bbb66e13f8 [nq] Fix incorrect handling of argv in PF_WriteBytes
This fixes an illegible server message error on going through a teleport
in the start map (how I noticed the problem). Funnily enough, I had
spotted the mistake when editing the qw version, but forgot to correct
the nq version.
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 fe891dd70b Merge branch 'master' into wip-rua_scene 2022-05-01 14:46:47 +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 fddff1c24d Merge branch 'master' into wip-rua_scene 2022-04-25 08:13:35 +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 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 ef574e67d0 [net] Remove client references from net_main
This is progress towards #23. There are still some references to
host_time and host_client (via nq's server.h), and a lot of references
to sv and svs, but this is definitely a step in the right direction.
2022-04-24 17:21:58 +09:00
Bill Currie e97b96b536 Remove some long dead cvars
The declarations were still around, but the creation and code using them
was removed long ago.
2022-04-13 14:17:58 +09:00
Bill Currie bffd0605b7 [nq] Show sub-millisecond times for serverprofile
Integer milliseconds are a little too coarse when the range is 1-3ms.
2022-04-08 18:29:04 +09:00
Bill Currie 8d725a1d0a [nq] Clean up Host_Frame_ a little
This simplifies the logic around dedicated servers and clients
connecting to remote servers.
2022-04-08 18:27:53 +09:00
Bill Currie f6541dbe3f [net] Remove client references from net_main
This is progress towards #23. There are still some references to
host_time and host_client (via nq's server.h), and a lot of references
to sv and svs, but this is definitely a step in the right direction.
2022-04-06 19:32:55 +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