Commit graph

11445 commits

Author SHA1 Message Date
Bill Currie
c02fcee58a [util] Make zone functions 64-bit clean
This allows nq and qw clients/servers to use over 2GB of memory if
necessary.
2021-07-26 15:43:57 +09:00
Bill Currie
5fc1a36d92 [gamecode] Be more forgiving of unresolved builtins
If the progs code never calls the functions, then there is no problem.
Thus unresolved builtin references get pointed to the bad function
builtin.
2021-07-26 13:35:35 +09:00
Bill Currie
60d23bdc8f [qfbsp] Remove all arbitrary bsp limits
Planes, verts, etc can now all get crazy big.
2021-07-26 13:10:06 +09:00
Bill Currie
2e33503c4c [vulkan] Fix a missed array index edit
Caused by the view model implementation, and missed because gcc needs
optimization to cache such errors (and my own error, of course).
2021-07-26 11:43:31 +09:00
Bill Currie
f47e03e606 [model] Remove 64k limit on visible leafs
Modern maps can have many more leafs (eg, ad_tears has 98983 leafs).
Using set_t makes dynamic leaf counts easy to support and the code much
easier to read (though set_is_member and the iterators are a little
slower). The main thing to watch out for is the novis set and the set
returned by Mod_LeafPVS never shrink, and may have excess elements (ie,
indicate that nonexistent leafs are visible).
2021-07-26 11:32:05 +09:00
Bill Currie
03921c03c5 [util] Expose set_expand and fix an out-by-one bug
Having set_expand exposed is useful for loading data into a set.

However, it turns out there was a bug in its size calculation in that
when the requested set size was a multiple of SET_BITS (and greater than
the current set size), the new set size one be SET_BITS larger than
requested. There's now some tests for this :)
2021-07-26 09:54:03 +09:00
Bill Currie
7995f59a90 [vulkan] Set the 2d near distance to 0
-999999 seems to be a hold-over from the software renderer passed
through both gl renderers. I guess it didn't matter in the gl renderers
due to various draw hacks, but it made quite a difference in vulkan.
Fixes the view model covering the hud.
2021-07-25 14:21:37 +09:00
Bill Currie
56c2fa380b [vulkan] Implement view model rendering
Quake just looked wrong without the view model. I can't say I like the
way the depth range is hacked, but it was necessary because the view
model needs to be processed along with the rest of the alias models
(didn't feel like adding more command buffers, which I imagine would be
expensive with the pipeline switching).
2021-07-25 14:03:25 +09:00
Bill Currie
13e1682f5e [qfbsp] Add an option to dump info about a bsp file
Just the header plus some basics of model info.
2021-07-25 12:14:04 +09:00
Bill Currie
81f73e4524 [gamecode] Support printing a single edict field 2021-07-25 09:54:08 +09:00
Bill Currie
342ba65f57 [qfcc] Handle aliased field types
Fixes use of structs as entity fields. The test is currently
compile-only.
2021-07-24 18:09:54 +09:00
Bill Currie
86cf7fbecd [gamecode] Check for null edict before printing number
Avoids segfault during double-verbose disassembly of progs code that
uses entities.
2021-07-24 18:04:57 +09:00
Bill Currie
7868936b96 [vulkan] Correct the skysheet scaling
Dunno where that 8 came from, but it's quite a bit different from 189/64
(2.953125). Fixes the excessively high skies in vulkan.
2021-07-24 14:23:06 +09:00
Bill Currie
1300cfb14e [console] Clean up key_menu input handling
Missed this little change in the menu/console untangling.
2021-07-24 14:21:54 +09:00
Bill Currie
40a26e4bc8 [scene] Rename libQFentity to libQFscene
And start working on scene management.
2021-07-24 14:20:59 +09:00
Bill Currie
076f424d39 [qw] Actually fix the idle scale
Oops. I really need to get cl_view merged.
2021-07-24 11:38:28 +09:00
Bill Currie
d3b7f7fbc8 [nq,qw] Fix broken intermission view
The idle scale was 114.591559 time too big (forgot both half angle for the
quaternion and converting from degrees to radians for the idle rotations).

Also, take the intermission view position and rotation direct from the
player entity, not viewstate, as while viewstate.origin is the same,
viewstate.rotation is the player's input, not the rotation set by the
server. Fixes the unlocked view angle.
2021-07-24 11:33:53 +09:00
Bill Currie
435009e2cd [entity] Update local rotation and scale caches
When setting local rotation/scale/transform, need to cache the rotation and
scale, otherwise they can't be fetched easily later on (position is easy as
it's just the fourth column of the matrix).
2021-07-24 11:31:00 +09:00
Bill Currie
c715fb384f Update .gitignore yet again 2021-07-24 10:12:24 +09:00
Bill Currie
632d2cb79c [console] Plug another escape handler leak 2021-07-24 00:28:49 +09:00
Bill Currie
fbbf83e696 [console] Pop menu escape in forced close menu
Fixes loss of access to the menu after selecting a new game via the menu.
2021-07-23 21:15:01 +09:00
Bill Currie
c134e9d348 [renderer] Remove R_EnqueueEntity from the plugin funcs
Forgot about this when fixing the ctf flags.
2021-07-23 12:46:53 +09:00
Bill Currie
3b586fc0a6 [console] Untangle console and menu toggling
The recent changes to key handling broke using escape to get out of the
console (escape would toggle between console and menu). Thus take care
of the menu (escape) part of the coupling FIXME by implementing a
callback for the escape key (and removing key_togglemenu) and sorting
out the escape key handling in console. Seems to work nicely
2021-07-23 02:28:37 +09:00
Bill Currie
30dc82f290 [qw] Use efrags for carried flags
This sorts out the unwanted use of R_EnqueueEntity, which will help with
removing another global (r_ent_queue), which is necessary for threaded
multi-pass rendering (ie, shadows).
2021-07-22 19:35:12 +09:00
Bill Currie
e799a7ae45 [qwaq] Readd libQFruamoko_client to qwaq-x11
Turned out it was needed after all (bad build test)
2021-07-22 18:08:13 +09:00
Bill Currie
b3e7b52696 [qw] Check for null file before checking size
Fixes a segfault when downloading a file that doesn't exist.
2021-07-22 18:02:36 +09:00
Bill Currie
e089234f38 [console] Link against libQFruamoko_console
Fixes shared plugin not loading due to missing symbol.
2021-07-22 18:01:18 +09:00
Bill Currie
49afdde77f [vulkan] Add some comments and clean some code
Figuring out bsp rendering for shadows is a fair bit harder than
expected :P
2021-07-22 16:15:14 +09:00
Bill Currie
f1ac8f2460 [renderer] Remove currententity from non-sw renderers
Really needed only for vulkan, but removing currententity from gl and
glsl made testing easier.
2021-07-22 16:15:14 +09:00
Bill Currie
41de8c9187 [util] Cast swapped signed shorts in bspfile
This fixes a bug when loading bsp29 files that resulted in leaf nodes
having bogus bounding boxes if any coordinates were negative (and thus
dynamic lights, and probably all sorts of other things) being broken.
And it took me only 9 years to notice :P
2021-07-22 14:25:51 +09:00
Bill Currie
8369a2206a [glstub] Add functions needed to get glsl working
Pity vulkan won't be so easy.
2021-07-22 10:12:41 +09:00
Bill Currie
3351b62318 [renderer] Move driver specific texture chain defs
The GL/GLSL/Vulklan texture chaining defs never should have been in
r_internal.h in the first place. They still need a better name, though.
2021-07-21 16:36:51 +09:00
Bill Currie
0f259c647b [vulkan] Clean out some dead code
While I might want to support lightmaps in the future (eg, for ambient
occlusion), the commented out code is confusing.
2021-07-21 14:54:07 +09:00
Bill Currie
5864406f4d [vulkan] Enable all lights when camera out of map
Without shadows, this is quite the cheat, but noclip is a cheat anyway,
so probably not that big a deal. It does, however, make noclip usable
for debugging.
2021-07-21 14:15:56 +09:00
Bill Currie
6962c5948a [vulkan] Clean up some more unused bsp data
Since vulkan supports 32-bit indexes, there's no need for the
shenanigans the EGL-based glsl renderer had to go through to render bsp
models (maps often had quite a bit more than 65536 vertices), though the
reduced GPU memory requirements of 16-bit indices does have its
advantages.
2021-07-19 23:38:09 +09:00
Bill Currie
924c970868 [vulkan] Pre-compute the sun's PVS
Any sun (a directional light) is in the outside node, which due to not
having its own PVS data is visible to all nodes, but that's a tad
excessive. However, any leaf node with sky surfaces will potentially see
any suns, and leaf nodes with no sky surfaces will see the sun only if
they can see a leaf that does have sky surfaces. This can be quite
expensive to calculate (already known to be moderately expensive for
just the camera leaf node (singular!) when checking for in-map lights)
2021-07-19 22:36:51 +09:00
Bill Currie
3ef89583af [gamecode] Correct pop implementations
Had src and dst swapped (yay for not testing :P (boo for not having an
easy way to test (yay for working on it))).
2021-07-19 22:31:22 +09:00
Bill Currie
87dc35e2fd [renderer] Be more consistent with msurface_t names
Use "surf" everywhere in gl, glsl and vulkan. Not worried about sw/sw32
at this stage (I don't poke around in there anywhere near as much).
2021-07-19 06:55:36 +09:00
Bill Currie
3c93d555e3 [gl] Correct calculation of screen aspect
vrect_t's fields are ints, and it was vid.aspect that prevented the
quotient being truncated. Fixes the rather squashed looking world.
2021-07-19 06:55:36 +09:00
Bill Currie
6b38a17cf1 [gamecode] Clean up state imlementations
This makes the code easier to read. Also, yay for automated tests:
caught a mistyped time :)
2021-07-15 16:55:02 +09:00
Bill Currie
f7efcde7ab [vulkan] Clean up and document some of the bsp code
Getting close to understanding (again) how it all works. I only just
barely understood when I got vulkan's renderer running, but I really
need to understand for when I modify things for shadows. The main thing
hurdle was tinst, but that was dealt with in the previous commit, and
now it's just sorting out the mess of elechains and elementss.
2021-07-13 22:59:51 +09:00
Bill Currie
c8e6f71a30 [renderer] Remove tinst from msurface_t
Its sole purpose was to pass the newly allocated instsurf when chaining
an instance model (ammo box, etc) surface, but using expresion
statements removes the need for such shenanigans, and even makes
msurface_t that little bit smaller (though a separate array would be
much better for cache coherence).

More importantly, the relevant code is actually easier to understand: I
spent way too long working out what tinst was for and why it was never
cleared.
2021-07-13 16:02:47 +09:00
Bill Currie
1078bd9efa [util] Implement Sys_Free for windows
And get the tests so they can (sort of) be run.
2021-07-12 18:55:16 +09:00
Bill Currie
0a847f92f1 [util] Use mmap/munmap for cmem internal alloc/free
This reduces the overhead needed to manage the memory blocks as the
blocks are guaranteed to be page-aligned. Also, the superblock is now
alllocated from within one of the memory blocks it manages. While this
does slightly reduce the available cachelines within the first block (by
one or two depending on 32 vs 64 bit pointers), it removes the need for
an extra memory allocation (probably via malloc) for the superblock.
2021-07-12 16:33:47 +09:00
Bill Currie
12450fe6b8 [vid] Remove redundant direct, conbuffer and conrowbytes 2021-07-11 13:44:00 +09:00
Bill Currie
6db6f8f0e2 [win] Fix a pile of bitrot
Man, those bits rot quickly. Must be stored with a rotfish.
2021-07-11 13:30:52 +09:00
Bill Currie
c636f7413d [util] Fix yet another suggested const warning
I keep forgetting to do an optimized build test
2021-07-11 13:29:05 +09:00
Bill Currie
108d2a0746 [qw] Fix an uninitialized var use
Found by valgrind
2021-07-11 12:31:34 +09:00
Bill Currie
6dff00a9da [qw] Move netgraph below the console
Also, make nq draw the vid views (in theory, it loads too fast to see
the loading pic).
2021-07-11 12:05:14 +09:00
Bill Currie
edbf4d262a [qw] Make the netgraph scale logarithmic
Full scale is 1s, but now ms timings are visible even with the default
height.
2021-07-11 11:02:37 +09:00