Commit Graph

1045 Commits

Author SHA1 Message Date
Bill Currie 674ffa0941 [util] Make bsp_t counts size_t
and other bsp data counts unsigned, and clean up the resulting mess.
2021-08-01 21:54:05 +09:00
Bill Currie ca63c0360a Do an audit of hunk mark usage
I realized that after making the hunk 64-bit clean, I had forgotten to
go through and convert all the saved marks to size_t.
2021-07-29 11:43:27 +09:00
Bill Currie 54604d9aa2 [util] Make hunk (optionally) thread-safe
For now, the functions check for a null hunk pointer and use the global
hunk (initialized via Memory_Init) if necessary. However, Hunk_Init is
available (and used by Memory_Init) to create a hunk from any arbitrary
memory block. So long as that block is 64-byte aligned, allocations
within the hunk will remain 64-byte aligned.
2021-07-29 11:43:27 +09:00
Bill Currie 50740c1014 [model] Remove the confusion about numleafs
The fact that numleafs did not include leaf 0 actually caused in many
places due to never being sure whether to add 1. Hopefully this fixes
some of the confusion. (and that comment in sv_init didn't last long :P)
2021-07-27 12:38:08 +09:00
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 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 81f73e4524 [gamecode] Support printing a single edict field 2021-07-25 09:54:08 +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 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 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 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 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 755ef524e4 [video] Use views instead of conwidth and conheight
conwidth and conheight have been moved into vid.conview (probably change
the name at some time), and scr_vrect has been replaced by a view as
well. This makes it much easier to create 2d elements that follow the
screen size (taking advantage of a view's gravity) which will, in the
end, make changing the window size easier.
2021-07-10 18:04:34 +09:00
Bill Currie e81d690b51 [input] Create QF input library using keys.c
This refactors (as such) keys.c so that it no longer depends on console
or gib, and pulls keys out of video targets. The eventual plan is to
move all high-level general input handling into libQFinput, and probably
low-level (eg, /dev/input handling for joysticks etc on Linux).

Fixes #8
2021-07-05 16:26:07 +09:00
Bill Currie 813497a1aa [ui] Create library for UI support code
Currently this has text buffer, input line, vrect and view code.
2021-06-12 22:50:51 +09:00
Bill Currie 1e9329ccf6 [nq,qw] Stop wring to config.cfg
QF now uses its own configuration file (quakeforge.cfg for now) rather
than overwriting config.cfg so that people trying out QF in their normal
quake installs don't trash their config.cfg for other quake clients. If
quakeforge.cfg is present, all other config files are ignored except
that quake.rc is scanned for a startdemos command and that is executed.
2021-04-12 22:09:09 +09:00
Bill Currie 87eccb9e6f [nq] Ensure stuffcmd is done for cl_quakerc 0
This was done years ago for qw, but missed for nq.
2021-04-11 20:09:03 +09:00
Bill Currie 972b0f8a70 [util] Make sizebuf and msg sizes unisgned
And clean up the mess.
2021-04-04 15:53:53 +09:00
Bill Currie e93cff124c [nq,qw] Fix strftime formats for windows
The incorrectness was hidden by the non-literal strings.
2021-03-30 17:38:42 +09:00
Bill Currie dac9166339 [nq] Sort out some of the issues with keydest
Switches to "game" properly when starting a new game after playing
menus. Of course, basic bindings are still broken in "demo".
2021-03-29 22:39:43 +09:00
Bill Currie 5f93c115ff [util] Make developer flag names easier to manage
They're now an enum, and the flag part of the name is all lowercase, but
now the flag definitions and names list will never get out of sync.
2021-03-29 22:38:47 +09:00
Bill Currie 6fea5f5e1a [build] Add -Wformat-non-literal option
While this caused some trouble for pr_strings and configurable strftime
(evil hacks abound), it's the result of discovering an ancient (from
maybe as early as 2004, definitely before 2012) bug in qwaq's printing
that somehow got past months of trial-by-fire testing (origin understood
thanks to the warning finding it).
2021-03-29 17:27:06 +09:00
Bill Currie a754dbca37 [util] Make va return const char *
And clean up the resulting mess.

I don't know why it wasn't doing so, but it certainly should have been.
2021-03-29 17:24:30 +09:00
Bill Currie 5d703c1f3e First stab at keydest sanitization 2021-03-27 20:43:51 +09:00
Bill Currie 88ff254f42 Get QF cross-compiling using MXE/mingw32
This includes -win clients (no clue if anything actually works yet).
2021-03-27 20:09:37 +09:00
Bill Currie a9bd436837 [build] Autoconfiscate printf format attribute
I don't know if gnu_printf is appropriate for all cases, but it is
needed for mingw32.
2021-03-27 19:52:59 +09:00
Bill Currie c9f1d770e0 Merge master into csqc-improvements
That was a mess
2021-03-25 22:01:31 +09:00
Bill Currie 7e2fcd1fbd Rename nq's cl.last_received_message to cl.last_servermessage.
And make it double rather than float because absolute time should not be
stored in a float.
2021-03-25 18:16:00 +09:00
Bill Currie 13677bc5d3 Rename nq's cl.scores to cl.players. 2021-03-25 18:15:12 +09:00
Bill Currie 52b714ea57 Move qw's player_info_t to client/state.h
And use it instead of scoreboard_t in nq.
2021-03-25 18:14:53 +09:00
Bill Currie 66fda1fddb Rewrite edict access.
The server edict arrays are now stored outside of progs memory, only the
entity data itself (ie data accessible to progs via ent.fld) is stored in
progs memory. Many of the changes were due to code accessing edicts and
entity fields directly rather than through the provided macros.
2021-03-25 18:13:48 +09:00
Bill Currie 132e25b096 Remove a bunch of unnecessary fields from nq.
The server never accesses the fields, and they're not used in qw either, so
no point in storing pointers to them.
2021-03-25 18:13:21 +09:00
Bill Currie 410fecd67b [client] Fix the transform memory leak
The transforms aren't actually freed at the end (more work), but at
least they aren't lost any more, though one is still lost for the
viewent (weapon). The obvious fix didn't work.
2021-03-21 23:05:13 +09:00
Bill Currie a3c1b2e992 [util] Rename qfplist.[ch]
The name is a hold-over from before the current quakeforge tree and the
QF include directory.
2021-03-21 16:13:03 +09:00
Bill Currie e3444b726f [model] Add a re-entrant Mod_LeafPVS
Double benefit, actually: faster when building a fat PVS (don't need to
copy as much) and can be used in multiple threads. Also, default visiblity
can be set, and the buffer size has its own macro.
2021-03-20 12:13:58 +09:00
Bill Currie 0ace799b27 [util] Support commands with a data parameter
Useful for avoiding a pile of wrapper functions that merely pass on
command-specific data to the actual implementation. Used to clean up the
wrappers in nq and qw cl_input.c
2021-03-20 03:56:16 +09:00
Bill Currie dc7cb97481 [qw] Remove viewangles from client state
Other than the one line in cl_pred.c, it's redundant, but it looks to be
just a redundant copy from ancient times.
2021-03-20 02:24:47 +09:00
Bill Currie 5cf1da7c25 [client] Finish moving onground to viewstate
Missed this in the entity cleanup (really, should have been separate
commits, but oh well).
2021-03-20 00:58:37 +09:00
Bill Currie 5bf21931c7 [renderer] Remove more old fields from entity_t
The only transform related field remaining is old_origin. This also
brings the renderer closer to using simd (lots of stuff to fix still,
though).
2021-03-20 00:08:21 +09:00
Bill Currie 2015474468 Move and clean up clview.h
Redundant or dead prototypes deleted, and the client/view.h seems a good
place for the file.
2021-03-12 11:48:53 +09:00
Bill Currie 8466de2325 [client] Use vec4_t in entity_state_t
And clean up the mess (sort of:P)
2021-03-11 16:19:49 +09:00
Bill Currie b8267f2edd [client] Merge nq/qw entity effects code 2021-03-11 11:25:04 +09:00
Bill Currie 098ceed5ff [client] Merge nq and qw temp entity handling
This finally gets cl_tent merged away.
2021-03-10 18:04:18 +09:00
Bill Currie fbc1bd9f6e [renderer] Clean up entity_t to a certain extent
This is the first step towards component-based entities.

There's still some transform-related stuff in the struct that needs to
be moved, but it's all entirely client related (rather than renderer)
and will probably go into a "client" component. Also, the current
components are directly included structs rather than references as I
didn't want to deal with the object management at this stage.

As part of the process (because transforms use simd) this also starts
the process of moving QF to using simd for vectors and matrices. There's
now a mess of simd and sisd code mixed together, but it works
surprisingly well together.
2021-03-10 00:01:41 +09:00
Bill Currie dfa7af03c6 [util] Plug a thread-safety hole in plists 2021-02-09 09:57:07 +09:00
Bill Currie 846fcc276c [nq] Allow free-fps for demo playback
I still need to look into making physics (and network, I imagine) work
with unlimited frame rates, but this gets in what I need for now.
2021-02-03 18:24:15 +09:00
Bill Currie 0bfb60775e [util] Ensure hunk allocs are cache alligned
This doesn't seem to make much difference in the vulkan renderer, but it
certainly doesn't hurt.
2021-02-03 13:19:19 +09:00
Bill Currie 34dc7cf2df [models] Move brush data into its own struct
This is a big step towards a cleaner api. The struct reference in
model_t really should be a pointer, but bsp submodel(?) loading messed
that up, though that's just a matter of taking more care in the loading
code. It seems sensible to make that a separate step.
2021-02-01 19:31:11 +09:00
Bill Currie bb6c6963d2 [model] Clean up the globals around model loading
Covers only the generic load code (alias etc to follow), but this should
take care of a lot of issues in the future.
2021-02-01 14:39:00 +09:00
Bill Currie 08b1d75582 [nq] Put the fps lock back in
That wasn't meant to be removed yet as there are physics problems, but
it's useful for renderer testing. It snuck in with the va patch.
2021-02-01 10:54:49 +09:00