Commit graph

13032 commits

Author SHA1 Message Date
Bill Currie
80c8b377c4 [nq] Get the deathmatch overlay working
The placement isn't exactly the same as it was (more centered), but it's
working and correctly appears and disappears on during bigass1.
2022-11-08 00:21:30 +09:00
Bill Currie
9bf506fec6 [ui] Implement View_Delete
As per the pre-ECS view code, the entire sub-hierarchy of views is
deleted along with the parent view.
2022-11-08 00:20:02 +09:00
Bill Currie
24d8d864a2 [ecs] Optionally delete entities on hierarchy removal
Useful for deleting an entire sub-hierarchy of entities.
2022-11-08 00:16:29 +09:00
Bill Currie
4197d4a800 [nq] Propagate demoplayback over CL_ClearMemory
Because demoplayback seen by the shared client code is in viewstate and
that's in cl, it gets set to 0 when connecting, thus the network icon
while playing demos.
2022-11-07 10:36:56 +09:00
Bill Currie
4dccad656f [nq] Remove the workarounds for same-hierarchy parenting
With the hierarchy code fixed for intra-hierarchy parenting, there's no
longer any need to first pull the sub-hierarchy out of the main
hierarchy before changing the parent, resulting in less memory churn.
2022-11-06 23:18:32 +09:00
Bill Currie
ddd6c958a9 [ecs] Fix parent index updates when removing sub-hierarchies
In the end, it was removal of the old entries that corrupted the parent
indices. Very nicely, most of the fixes involved removing code. Taking
advantage of the ECS to debug the hierarchies was fun, and the resulting
colorized entity names helped no end.
2022-11-06 23:04:40 +09:00
Bill Currie
5ce0f4735c [nq] Correct the number of children for the health view
It needs only 3 as the face has its own view.
2022-11-06 20:11:45 +09:00
Bill Currie
1130919049 [ecs] Add a simplified test of the sbar hierarchy
Even 37 objects is a lot, but it's a whole lot better than 180. Most
importantly, it reproduces the problem, which seems to be not all parent
indices getting updated. The child indices seem to be working nice, as
do the reference object indices (ie, the entity components). I suspect
its the parent indices getting corrupted that cause problems on the
second switch of the hud/sbar cvar as the parent indices are used to
find the child indices that need to be updated.
2022-11-06 20:04:34 +09:00
Bill Currie
cf6b4efe5d [ecs] Colorize hierarchy test output
Just the tiniest bit of color goes a long way to spotting issues.
2022-11-06 20:03:29 +09:00
Bill Currie
97a6ce833e [ecs] Adjust the source root during self insertions
This improves the behavior of hierarchies when self-inserting, but nq's
sbar still crashes when trying to do so. However, its tree is a fair bit
more complex than the test case (that does pass now), so I need to try
to replicate the important parts of the tree with fewer objects (180 is
too many to work with).
2022-11-06 17:36:49 +09:00
Bill Currie
ecf59c8141 [ecs] Add failing same-hierarchy parenting test
As expected, reparenting a sub-hierarchy such that it (and possibly its
children) move up the arrays fails (this is why sbar needs to first
remove the sub-hierarchy then insert it).
2022-11-06 17:36:33 +09:00
Bill Currie
05947c8ac4 [ecs] Rework new hierarchy test for same-hierarchy
Since test_build_hierarchy2 already tested removal of a sub-hierarchy
(once fixed), it seems test_build_hierarchy3 testing parenting within
the same hierarchy would be a good idea. Reparenting such that
everything moves to later in the arrays works nicely (not very
surprising).
2022-11-06 08:36:43 +09:00
Bill Currie
d5de8bf53f [nq] Get hud_sbar working for the most part
Setting the parent to another object in the same hierarchy still causes
a segfault (worked around for now), but the mangled views were caused by
View_UpdateHierarchy not being called prior to the first call to
set_hud_sbar (why, though? I suspect something to do with oldlen). And
ECS_SortComponentPool finally gets used to ensure the sbar panels are
behind the info pics.
2022-11-06 03:08:50 +09:00
Bill Currie
b91568d234 [ecs] Improve the behavior of Hierarchy_RemoveHierarchy
Its updates to the various indices were out, but this was missed due to
the tests being wrong. I wonder if I got interrupted while working on
them last and just assumed the removals were correct. This improves
sbar's behavior, but it's still wrong when pulling the armory view out
of the inventory. Very unsure what's going on, but the various indices
look ok, as do the view positions.
2022-11-06 02:38:59 +09:00
Bill Currie
01c67a345f [ecs] Fix some more hierarchy tests
Ugh, things were quite bad, it turns out. It seems a lot of trouble
would have been saved if these tests had worked (however, something is
still not quite right as views are out of place).
2022-11-06 00:30:55 +09:00
Bill Currie
f89fbf9724 [ecs] Fix a child miscount in the test case
Heh, that was a bit funny, actually, but it makes me wonder just how
broken sub-hierarchy deletion was.
2022-11-05 23:44:01 +09:00
Bill Currie
26438848ce [ecs] Add a failing hierarchy test
This is the bug that sbar found when pulling a sub-hierarchy out of a
larger hierarchy: child indices not getting updated correctly for later
siblings and any niece objects.
2022-11-05 22:23:46 +09:00
Bill Currie
10037927ea [ecs] Add hierarchy-only tests
The hierarchy-specific tests from the transform tests have been moved
into the ecs tests and the transform tests renamed appropriately. As
part of the process, hierarchies can now have a null type (ie, no
additional components maintained by the hierarchy). This should make
sorting out the issues highlighted by sbar a bit easier.
2022-11-05 21:29:38 +09:00
Bill Currie
57cd30fca3 [ecs] Move parent setting logic into hierarchy
It should have always been here, but when I first created the hierarchy
and transform objects, I didn't know where things would go. Having two
chunks of code for setting an entity's parent was too already too much,
and I expect to have other hierarchy types. Doesn't fix the issues
encountered with sbar, of course.
2022-11-05 17:54:49 +09:00
Bill Currie
42963f97c0 [client] Clean up some hud redundancies
hud_view is set up by sbar, and the other views are no longer used.
2022-11-05 16:47:52 +09:00
Bill Currie
7b2f14114d [nq] Get most of the hud working
Frags, minifrags and miniteam now work (mostly, the auto-switching
between them is not working yet). Switching between hud and sbar is
mostly working, except for some problems with the hierarchies corrupting
themselves: setting the parent of an object to another object in the
same hierarchy is just completely broken, and working with complex
hierarchies seems to mess up something (things getting out of phase). I
guess my unit tests were too simple.

For nq, all that remains is the various overlays (death-match,
intermission and finale) and rogue and hipnotic specific updates.
Fortunately, other than the death-match overlay, qw is just a subset of
nq for the hud (and even then, I imagine the info in qw would be nice in
nq).
2022-11-05 16:41:37 +09:00
Bill Currie
3d30e78da9 [client] Add hud_debug cvar to draw view outlines
It's much easier to debug the hud when even otherwise invisible views
can be seen.
2022-11-05 16:38:07 +09:00
Bill Currie
5f98dac214 [client] Add a hud outline component for debug
Very handy for verifying views are placed correctly. Also fix some type
issues with the func and update components.
2022-11-05 10:55:45 +09:00
Bill Currie
b5087e79e1 [nq] Get center print working again
While the word-level text objects aren't used (because standard center
print messages are already flowed as such), using a passage object makes
dealing with the lines and incremental printing quite easy and
efficient (everything is counted just the once or twice, not every frame).
2022-11-04 16:33:40 +09:00
Bill Currie
472b6995b7 [ui] Set passage text object start and size
The text object covering the whole passage was not being initialized,
thus center print tried to print rubbish when (incorrectly) printing the
entire message.
2022-11-04 15:26:01 +09:00
Bill Currie
1d51c05f90 [ui] Make passage objects reusable
I had intended to do this for a while, but now that I want it for center
print strings, it was time to make the change.
2022-11-04 13:06:20 +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
c0cfeec5d6 [nq] Clean up sbar updates for info changes
Most of the update functions are scheduled by Sbar_Changed() using
tables to determine what update functions need to be called for which
view entities. As hud_updateonce is called, and an entity can have only
one of any component, this becomes a set of updates to call when during
hud/sbar rendering.
2022-11-04 11:31:11 +09:00
Bill Currie
5f01dc9fb5 [client] Make the hud update function type explicit 2022-11-04 11:10:56 +09:00
Bill Currie
99e12872e5 [console] Get menu rendering working again
For certain values of working. The whole thing needs a rewrite but it's
nice that using an ECS doesn't force everything to conform to that
model.
2022-11-04 10:38:07 +09:00
Bill Currie
70dae21ea6 [nq] Get face animations working again 2022-11-04 10:00:08 +09:00
Bill Currie
6b99697e82 [ui] Get flowed views working with ECS
I'm not particularly happy with the way onresize is handled, but at this
stage a better way of dealing with resizing views and getting the child
views to flow correctly hasn't come to mind. However, the system should
at least be usable.
2022-11-04 00:29:13 +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
a07eccd5c7 [glsl] Fix some GLSL conformance issues
I'm not sure when things broke on my laptop (I thought I got warp and
fisheye working on my laptop), but it turns out things weren't quite
right, thus warp (and presumably fisheye) weren't working properly due
to GLSL errors that I only just noticed. This fixes water warp (and
probably fisheye).
2022-11-03 16:42:49 +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
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
708978eea9 [client] Clean up some entity component accesses 2022-11-02 09:53:52 +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
e67b374fd4 [ui] Propagate resize deltas in view hierarchies
While it hasn't been a problem yet (no multi-level resizing), I'm sure
it will be before too long.
2022-11-01 10:59:28 +09:00
Bill Currie
e504079938 [qwaq] Disable console screen view set for now
The renderer currently does not have a view, and the qwaq console isn't
used right now anyway.
2022-11-01 10:18:47 +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
81e23b2e52 [console] Remove a debug print 2022-11-01 10:14:50 +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
cf911884c6 [ecs] Add support for sorting component pools
As the bookkeeping data is spread between three arrays, sorting a
component pool is not trivial and thus not something to duplicate around
the codebase.
2022-10-31 13:10:53 +09:00
Bill Currie
962319af09 [ecs] Make Ent_HasComponent more robust
It doesn't check that the entity itself is valid, but it does at least
check that the index fetched from the sparse array is valid. Fixes a
segfault when a valid entity never had the component.
2022-10-31 13:06:55 +09:00