Commit graph

1933 commits

Author SHA1 Message Date
Bill Currie
cb72769aa9 [model] Clean up the model struct a little
Mostly just removing some (near) dead fields and making the
flags/effects more clear on what it's for.
2023-09-14 20:35:45 +09:00
Bill Currie
8ff2c5a747 [util] Support utf-8 strings in Sys_Printf
By default. Conversion of quake strings needs to be requested (which is
done by nq and qw clients and servers, as well as qfprogs via an
option). I got tired of seeing mangled source code in the disassembly.
2023-08-23 21:40:50 +09:00
Th3T3chn0G1t
3098b5d3f7 Implement clang support
Fixing a load of issues related to autoconf and some small source-level issues to re-add clang support.
autoconf feature detection probably needs some addressing - partially as -Werror is applied late.
2023-08-11 14:25:01 +09:00
Bill Currie
15d7222ebb [model] Remove Mod_LeafPVS in favor of mix/set
The use of a static set makes Mod_LeafPVS not thread safe and also means
that the set is not usable with the set iterators after going to a
smaller map from a larger map.
2023-08-05 11:51:01 +09:00
Bill Currie
35ec2ebb4c [scene] Move dynamic lights into the scene ECS
While the insertion of dlights into the BSP might wind up being overly
expensive, the automatic management of the component pool cleans up the
various loops in the renderers.

Unfortunately, (current bug) lights on entities cause the entity to
disappear due to how the entity queue system works, and the doubled
efrag chain causes crashes when changing maps, meaning lights should be
on their own entities, not additional components on entities with
visible models.

Also, the vulkan renderer segfaults on dlights (fix incoming, along with
shadows for dlights).
2023-08-04 15:08:56 +09:00
Bill Currie
ad1b2d00d4 [nq,qw] Add a debug_debug cvar
Setting the cvar to > 0 causes demo playback to stop (via demo_speed 0)
when the read packet count reaches the specified value. Very useful for
debugging rendering glitches that are easily reproduced in a demo.
2023-07-28 19:19:13 +09:00
Bill Currie
c0f8d102ad [scene] Implement Scene_FreeAllEntities (and use it)
I guess I wasn't sure how to find all the allocated entities from within
the registry, but it turned out to be trivial. This takes care of leaked
static entities (and, in a later commit, leaked light entities, which is
how I found the problem).
2023-07-22 16:50:18 +09:00
Bill Currie
6e9f50ffe4 [vid] Ensure window size gets sent after init
This fixes a pile of window size related issues I've seen for a while,
but most importantly, some nastiness with division by 0 and segfaults.
2023-07-14 11:57:36 +09:00
Bill Currie
300badc96a Fix a couple of windows build issues
There's still the problem with unused variables when building for
windows because of vulkan debug stuff, but this fixes the important
errors. It actually still works (at least under wine).
2023-07-06 02:04:47 +09:00
Bill Currie
5099633bc8 [console] Start work on a debug UI
It does almost nothing (just puts a non-function button on the screen),
but it will help develop the IMUI code and, of course, come to help with
debugging in general.
2023-07-01 20:00:26 +09:00
Bill Currie
0b0271ee76 [console] Provide control of cursor visibility
It's usually desirable to hide the cursor when playing quake, but when
using the console, or in various other states, being able to see the
cursor can be quite important.
2023-06-30 14:57:04 +09:00
Bill Currie
ecb9a15946 [model] Clean up the brush leaf api a little
Those functions now all take mod_brush_t since they don't work with any
other type of model.
2023-06-28 21:45:41 +09:00
Bill Currie
9d1c07d2ac Fix a few strict aliasing warnings
gcc 13 got a little stricter on those (at least with gnu2x/c2x).
2023-06-13 18:13:54 +09:00
Bill Currie
dbd3d6502a Nuke qboolean from orbit
I never liked it, but with C2x coming out, it's best to handle bools
properly. I haven't gone through all the uses of int as bool (I'll leave
that for fixing when I encounter them), but this gets QF working with
both c2x (really, gnu2x because of raw strings).
2023-06-13 18:06:11 +09:00
Bill Currie
7d4c1d79b1 [plist] Use reference counts for items
This makes it much easier to share items between property lists (eg,
targets and the main entity list in cl_light).
2023-03-13 11:26:13 +09:00
Bill Currie
d59dcba37d [qw] Update http_progress for recent curl
CURLOPT_PROGRESSFUNCTION was deprecated in favor of
CURLOPT_XFERINFOFUNCTION (and the parameters for the callback adjusted).
I'm not sure why this didn't trigger until now.
2023-02-14 12:45:04 +09:00
Bill Currie
3c8f02c655 [client] Switch to using canvases for screen and hud
Canvases provide layered rendering as for each canvas all components are
rendered in turn.
2023-01-21 03:43:18 +09:00
Bill Currie
68c7003991 [console] Separate loading and initialization
This will make it easy for client code to set up data needed by the
console before the console initializes. It already separates console
cvar setup and initialization, which has generally been a good thing.
2023-01-20 13:27:17 +09:00
Bill Currie
06fdef52e8 Clean up some unneeded console.h includes 2023-01-20 12:59:45 +09:00
Bill Currie
41d25df0d2 [ui] Attach text views to passage entities
Instead of creating new entities for the text views. This approximately
halves the number of entities required to display flowed text, but also
tests the ability to have an entity in multiple hierarchies (the goal of
the ECS component and system changes).
2022-12-14 22:38:37 +09:00
Bill Currie
bb677a1a7c [ecs] Move href_comp into hierarchy_t
This means that the component id used for hierarchy references must be
passed to Hierarchy_New and Hierarchy_Copy, but does all an entity to
have more than one hierarchy, which is useful for canvases (hierarchies
of views) in the 3d world (the canvas root would have a 3d hierarchy
reference and a 2d (view) hierarchy reference).
2022-12-12 00:20:20 +09:00
Bill Currie
7a64bb1149 [client] Use realtime for net icon check
viewstate's time is from cl.time which is not what's used to set
last_servermessage (that uses realtime). After careful investigation, I
found that cl.time is not at all suitable and that the original id code
used realtime (I think it was just me being lazy when I merged the
code). Fixes the stuck net icon.
2022-12-01 17:52:40 +09:00
Bill Currie
9ba2d26542 [client] Move sbar.h into client
Where it belongs :P
2022-12-01 15:00:09 +09:00
Bill Currie
47163ef2c4 [qw] Fix packet log svc check
Fixes the svc_updatepl name not being printed
2022-11-16 11:38:05 +09:00
Bill Currie
387f17dc0c [scene] Add a color map component
It's currently used only by the vulkan renderer, as it's the only
renderer that can make good use of it for alias models, but now vulkan
show shirt/pants colors (finally).
2022-11-15 15:30:35 +09:00
Bill Currie
0e64f959e2 [scene] Move visibility management into scene code
Well, sort of: it's still really in the renderer, but now calling
R_AddEfrags automatically updates the visibility structure as necessary,
and deleting an entity cleans up the efrags automatically. I wanted this
over twenty years ago.
2022-11-13 15:08:18 +09:00
Bill Currie
767b39b7bd [client] Implement the scoreboards and spectator
This gets the status bar/hud back into function state.
2022-11-13 04:15:26 +09:00
Bill Currie
72e57367bf [qw] Check player name exists in spectator tracking
Fixes a segfault when the tracked player disconnects.
2022-11-12 14:40:18 +09:00
Bill Currie
0ea5c1fa14 [qw] Call CL_NetUpdate only when active
Calling CL_NetUpdate while not active (or more importantly, while not
connected) results in a buffer write error (Sys_Error). Active was
chosen because that's how the old sbar code worked, and it seems
reasonable to stick with it rather than requesting pings etc during the
connect process.
2022-11-12 11:41:09 +09:00
Bill Currie
0d9b475759 [client] Implement finale overlay and death-solo
Deathmatch overlay isn't working properly for end of level or death in
qw.
2022-11-12 01:47:17 +09:00
Bill Currie
c6b79d49a4 [client] Fix incorrect function component setup
Need to pass the address of the pointer :/
2022-11-10 21:23:04 +09:00
Bill Currie
39074ba3c1 [qw] Implement hud ping and pl indicators
As well as the periodic update of pings when the scoreboard or hud ping
are shown.
2022-11-10 15:34:31 +09:00
Bill Currie
e0fa853f47 [client] Implement the update functions
nq's frags don't update properly yet, and there's still a lot of
optimization to sort out, but it seems to be fairly usable again.
2022-11-10 01:35:33 +09:00
Bill Currie
1b90f2320e [client] Extend sbar's api
I think this makes the purpose of the functions more clear and makes the
protocol logic less dependent on the meaning of some of the updates.
Most of the update functions are not fully implemented yet.
2022-11-09 19:41:59 +09:00
Bill Currie
73e62de2fb [client] Clean up sbar's globals access
I had forgotten that the cl structs in nq and qw were different layouts,
which resulted in qw's sbar/hud being quite broken. Rather than messing
with the structs, I decided it would be far better in the long run to
clean up sbar's access to the cl struct and the few other nq/qw specific
globals it used. There are still plenty of bugs to fix, but now almost
everything is in the one place.
2022-11-09 19:38:54 +09:00
Bill Currie
34f0a59441 [client] Merge sbar
At long last, the status bar code is now shared between nq and qw. There
are many bugs to fix, but at least now they're all in the one place.
2022-11-08 17:42:27 +09:00
Bill Currie
2a53047007 [nq,qw] Clean up centerprint dstring
It was quite redundant and the optimization it vaguely provided belongs
in sbar and not in the protocol parser.
2022-11-04 12:51:43 +09:00
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
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
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
9f01cb25fe [qw] Move netgraph setup into cl_ngraph
This finally gets cl_screen so it can be merged.
2022-11-02 10:33:06 +09:00
Bill Currie
010b61ee8b [qw] Move viewstate movecmd setting to input code
Cleans up cl_screen and even simplifies the code. Double bonus :)
2022-11-02 10:05:58 +09:00
Bill Currie
9c6c59b370 [qw] Move view hight adjustment out of screen update
cl_screen.c is that little bit closer to being merged.
2022-11-02 09:52:35 +09:00
Bill Currie
efee9c87a9 [nq,qw] Minimize differences in cl_screen.c 2022-11-01 21:00:40 +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
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
dd1554aed3 [qw] Set cl.viewstate.time when setting cl.time
Fixes cshifts not fading. I'm sure there is a better fix, but this at
least gets qw mostly usable (for testing, at least: something is wonky
with roll).
2022-10-22 14:15:36 +09:00
Bill Currie
394018b3c5 [qw] Fix carried flag handling
I guess some of the earlier entity/scene handling hadn't been tested for
flags as no entity was ever being created for a flag. This fixes a
segfault when another player carrying a flag is potentially visible.

Also make the -16 Z offset local. It looks better than global, and the
global was quite wrong anyway as it was incorrectly updating W (which
caused me to spend way too long figuring out why positions were
breaking).

There are still issues with flag handling, and things are likely to
change with the ECS updates, but at least this lets me test.
2022-10-22 12:46:51 +09:00
Bill Currie
76124ab868 [qw] Document most of the mvd cvars
Many are unused, but it's nice to have the info there.
2022-10-15 14:47:53 +09:00