Commit Graph

2014 Commits

Author SHA1 Message Date
Bill Currie 2477a44d15 [client] Move cshift info from viddef to viewstate
It makes much more sense for cshift state to be in viewstate because it
is very much an effect rather than anything specific to a renderer.
2022-02-28 16:55:12 +09:00
Bill Currie 7d059a0b56 [client] Merge nq and qw cl_view
They've been near-identical for years, now they're only one. It proved
necessary to start merging the HUD code which for now is just a few cvar
declarations (not even init), but that should be a separate set of
commits.
2022-02-28 12:12:51 +09:00
Bill Currie aac9069d9f [nq,qw] Clean up cl_view's use of the client struct
This is a huge step towards merging cl_view.
2022-02-25 16:54:45 +09:00
Bill Currie f04459f03f [nq,qw] Clean up some bogus diffs in cl_view
The diffs were caused by white space and a redundant line.
2022-02-25 11:39:11 +09:00
Bill Currie deff95f490 [client] Merge chase camera and much of input
Handling of view angles is a little hacky at the moment, but this gets
the chase camera code and most of the common input code into one place,
which will make cleaning up the camera code much easier.
2022-02-22 15:51:28 +09:00
Bill Currie db8cf68ef3 [gamecode] Pass registered data pointer to builtins
This is the bulk of the work for recording the resource pointer with
with builtin data. I don't know how much of a difference it makes for
most things, but it's probably pretty big for qwaq-curses due to the
very high number of calls to the curses builtins.

Closes #26
2022-02-14 12:28:38 +09:00
Bill Currie 622a2e84f4 [nq,qw] Update WriteBytes for the Ruamoko ISA
More va_list shenanigans.
2022-02-06 21:20:00 +09:00
Bill Currie ab4c950c34 [qw] Print temp entity type number
More net_packetlog improvements
2022-02-06 21:20:00 +09:00
Bill Currie ff08ef3fa3 [nq,qw] Fix segfault when calling think
Think has no "other", and E_POINTER doesn't check for null (by design:
it's meant to be as fast as possible).
2022-02-06 21:20:00 +09:00
Bill Currie 748f578856 [qw] Fix incorrect "server to client" log messages
It's not very helpful thinking all the packets are incoming to the
client.
2022-02-06 21:20:00 +09:00
Bill Currie 7c6ef06dfb [gamecode] Make PF_VarString v6p-only
It's not enforced a this stage, and it would be easy enough to handle,
but it turns out all the standard quake and quakeworld progs never used
... for the print functions: the behavior of PF_VarString was
undocumented and so... tough :P.
2022-02-06 21:20:00 +09:00
Bill Currie 5500d835fe [qw] Fix a mangled builtin number
When doing the builtin params data change, I had somehow switch
multicast's number from 82 to 81. Fortunately, another builtin is also
81, so the VM told me off when I tried to run qw-server :)
2022-02-05 10:29:20 +09:00
Bill Currie 01345ba675 [gamecode] Wrap most uses of PR_RESET_PARAMS with push/pop frame
rua_obj was skipped because that looks to be a bit more work and should
be a separate commit.

This is to avoid the stack getting mangled when calling progs functions
with parameters.
2022-02-05 10:26:47 +09:00
Bill Currie 2a8fca80a0 [nq,qw] Give the menu and server progs stacks
They're going to need them :P
2022-02-04 21:53:37 +09:00
Bill Currie 9c51c3d2e1 [gamecode] Add a data pointer passed to builtin functions
This is part of the work for #26 (Record resource pointer with builtin
function data). Currently, the data pointer gets as far as the
per-instance VM function table (I don't feel like tackling the job of
converting all the builtin functions tonight). All the builtin modules
that register a resources data block pass that block on to
PR_RegisterBuiltins.
2022-01-24 00:20:05 +09:00
Bill Currie a6b932025c [gamecode] Provide builtins with information about their parameters
This will make it possible for the engine to set up their parameter
pointers when running Ruamoko progs. At this stage, it doesn't matter
*too* much, except for varargs functions, because no builtin yet takes
anything larger than a float quaternion, but it will be critical when
double or long vec3 and vec4 values are passed.
2022-01-23 22:27:27 +09:00
Bill Currie 3c86660d4a [gamecode] Rename MAX_PARMS to PR_MAXPARAMS 2022-01-23 14:17:25 +09:00
Bill Currie 234f2212d6 [gamecode] Run an audit of progs parameter setup
nq was just a bit of whitespace, but qw had an actual bug where the
parameters were not being reset before writing to them. It really
doesn't help that I don't know where to get progs suitable for testing
(really don't what to have to write my own).
2022-01-22 16:00:04 +09:00
Bill Currie 068c04ece6 [gamecode] Add ev_ushort and partial support
Really, only just enough to get everything compiling (which does include
vkgen running correctly).
2022-01-18 22:08:37 +09:00
Bill Currie cd30408675 [gamecode] Rename ev_quat to ev_quaternion
I much prefer the full name, though the short version is easier to type.
2022-01-18 17:05:12 +09:00
Bill Currie e9e54d08c0 [gamecode] Rename func_t to pr_func_t
Even more consistency.
2022-01-18 15:36:58 +09:00
Bill Currie afd1eb775b [gamecode] Rename ev_pointer to ev_ptr
Rather short (no worse than ev_int, though) but more consistency is
usually a good thing.
2022-01-18 14:36:06 +09:00
Bill Currie cfe7c44df0 [gamecode] Rename ev_integer to ev_int
And other related fields so integer is now int (and uinteger is uint). I
really don't know why I went with integer in the first place, but this
will make using macros easier for dealing with types.
2022-01-18 13:27:19 +09:00
Bill Currie 2df64384c1 [gamecode] Clean up string_t and pointer_t
They are both gone, and pr_pointer_t is now pr_ptr_t (pointer may be a
little clearer than ptr, but ptr is consistent with things like intptr,
and keeps the type name short).
2022-01-18 12:11:14 +09:00
Bill Currie 0bd05c71ac [gamecode] Use unsigned for entity values
I don't know why they were ever signed (oversight at id and just
propagated?). Anyway, this resulted in "unsigned" spreading a bit, but
all to reasonable places.
2022-01-16 22:15:18 +09:00
Bill Currie 2b82533526 [gamecode] Add double time state instructions
This has been a long-held wishlist item, really, and I thought I might
as well take the opportunity to add the instructions. The double
versions of STATE require both the nextthink field and time global to be
double (but they're not resolved properly yet: marked with
"FIXME double time" comments).

Also, the frame number for double time state is integer rather than
float.
2022-01-16 21:27:49 +09:00
Bill Currie c9b2a740a0 [gamecode] Add etypes for long and ulong
And partial implementations in qfcc (most places will generate an
internal error (not implemented) or segfault, but some low-hanging fruit
has already been implemented).
2022-01-05 22:32:07 +09:00
Bill Currie 9aa8f18d73 [math] Split out Quat/Vector compare implementations
This renames existing VectorCompCompare (and quaternion equivalent) to
VectorCompCompareAll and makes VectorCompCompare produce a vector of
results with optional negation (converting 0,1 to 0,-1 for compatibility
with simd semantics).
2022-01-02 01:09:51 +09:00
Bill Currie be474d9937 [gamecode] Remove the wart from def and function names
I never liked the leading s_ (though I guess it means one is supposed to
interpret the int as a string pointer, but meh).
2021-12-31 15:02:31 +09:00
Bill Currie 7a481039f8 [qw] Check tracked player name before printing
The server switching levels while the client is tracking a player (at
least a server client) seems to at least temporarily clear the player
slot and thus the name value pointer becomes null. This fixes the
resulting segfault.
2021-12-30 02:02:22 +09:00
Bill Currie 760256c99e [qw] Add SV_ClientNumber builtin
This is a quick way to find the client number for an entity. It returns
-1 if the entity is not a valid client (either outside the client block,
or not currently in use by a client).
2021-12-29 21:22:51 +09:00
Bill Currie dd17e8120d [qw] Clear qtv message buf before writing
I'm not sure this is the right place, but it prevents the packet
overflowing when a qtv proxy connects to a busy server (12+ bots).
2021-12-27 22:55:29 +09:00
Bill Currie 6d6440457a [qw] Add progs memory display to server status bar
This makes it easy to check for memory leaks before they crash the
server.
2021-12-27 20:28:33 +09:00
Bill Currie 94871671d2 [qw] Use a callback for netchan logging
This gets outgoing packet logging working again. Yay, fill my hard-drive
faster ;)
2021-12-27 17:54:58 +09:00
Bill Currie 2d109e615b [client] Clean up a stray reference to the renderer
Reaching into the renderer internals for r_worldmodel doesn't work when
the plugins are not static.
2021-12-24 06:45:13 +09:00
Bill Currie 8d2791752e [particles] Merge particle spawning into client
After yesterday's crazy marathon editing all the particles files, and
starting to do another big change to them today, I realized that I
really do need to merge them down. All the actual spawning is now in the
client library (though particle insertion will need to be moved). GLSL
particle rendering is semi-broken in that it now does only points (until
I come up with a way to select between points and quads (probably a
context object, which I need anyway for Vulkan)).
2021-12-24 06:45:13 +09:00
Bill Currie 5128029368 [nq,qw] Clear render state when leaving active state
This fixes a segfault caused by b0517e89293 that I had missed due to not
actually playing: ie, demo map changes were ok, but not in-game map
changes.
2021-12-24 06:45:13 +09:00
Bill Currie 2086125e0b [quakefs] Take in the pointer to the global hunk
This is needed for cleaning up excess memsets when loading files because
Hunk_RawAllocName has nonnull on its hunk pointer (as the rest of the
hunk functions really should, but not just yet).
2021-12-24 06:45:13 +09:00
Bill Currie 84a24dbb34 [renderer] Make R_RenderView private
This is actually a better solution to the renderer directly accessing
client code than provided by 7e078c7f9c.

Essentially, V_RenderView should not have been calling R_RenderView, and
CL_UpdateScreen should have been calling V_RenderView directly. The
issue was that the renderers expected the world entity model to be valid
at all times. Now, R_RenderView checks the world entity model's validity
and immediately bails if it is not, and R_ClearState (which is called
whenever the client disconnects and thus no longer has a world to
render) clears the world entity model. Thus R_RenderView can (and is)
now called unconditionally from within the renderer, simplifying
renderer-specific variants.
2021-12-24 06:45:12 +09:00
Bill Currie 4dc2e6cac2 [nq,qw] Reset view animation pose when model changes
I think this bug has been haunting us since we introduced lerping. I do
remember chasing bad pose indices 20 years ago and never finding the
cause. I guess we never thought to check the view model.
2021-12-17 08:21:32 +09:00
Bill Currie ba49c64fc3 [qw,nq] Clean out sbar key_dest handling
I really don't remember why it mattered if key_dest was game. If it was
draw layer issues, then this wasn't the correct fix anyway.
2021-11-29 00:03:53 +09:00
Bill Currie ca23065b90 [qw] Get chat info flag mostly working again
Currently does only chat (not afk), but the whole thing needs work
anyway (billboarded world-space canvas or similar).
2021-11-29 00:01:57 +09:00
Bill Currie b0447c1cf1 [console] Get message modes and menus working again
I'm not at all happy with con_message and con_menu, but fixing them
properly will take a rework of the menus (planned, though). Also, the
Menu_ console command implementations are a bit iffy and could also do
with a rewrite (probably part of the rest of the menu rework) or just
nuking (they were part of Johnny on Flame's work, so I suspect had
something to do with joystick bindings).
2021-11-28 23:21:55 +09:00
Bill Currie 413cea6b4a [qw,nq] Connect up key_demo
And clean up some remaining keydest refs (still a few more to go).

Need to sort out default bindings for key_demo, though.
2021-11-26 20:27:42 +09:00
Bill Currie 3f299155a3 [client] Reimplement legacy bind and unbind commands
This allows id1/qw config files, and to a certain extent scripts, to
work with the new binding system. It does highlight just how limited the
original system was (many keys could not bound).

Mouse axis input does not work yet as that needs a little more work to
support +strafe and +mlook.
2021-11-25 13:36:02 +09:00
Bill Currie 06c21d3c34 [qw,nq] Correct the axis modes
It turns out accumulate is not really suitable now that relative axis
accumulation is done in the binding processing, and was never suitable
for absolute inputs (in this context, of course: there are contexts
where accumulate is suitable for absolute inputs).
2021-11-23 22:04:56 +09:00
Bill Currie 1ef99a9130 [input] Separate absolute and relative axis inputs
Combining absolute and relative inputs at the binding does not work well
because absolute inputs generally update only when the physical input
updates, so clearing the axis input each frame results in a brief pulse
from the physical input, but relative inputs must be cleared each frame
(where frame here is each time the axis is read) but must accumulate the
relative updates between frames.

Other than the axis mode being incorrect, this seems to work quite
nicely.
2021-11-23 22:04:17 +09:00
Bill Currie 3ac6d2aa22 [x11] Use barriers to trap the pointer in the window
This should be a much friendlier way of "grabbing" input, though I
suspect that using raw keyboard events will result in a keyboard grab,
which is part of the reason for wanting a friendly grab.

There does seem to be a problem with the mouse sneaking out of the
top-right and bottom-left corners. I currently suspect a bug in the X
server, but further investigation is needed.
2021-11-22 14:59:27 +09:00
Bill Currie e45d19835c [x11] Add initial support for XInput2
Right now, only raw pointer motion and button events are handled, and
the mouse escapes the window, and there are some issues with focus in
focus-follows-mouse environments. However, this should be a much nicer
setup than DGA.
2021-11-21 23:42:33 +09:00
Bill Currie 83abdfa7b9 [qw] Rmove include of rpc/types.h
I have no idea why it was necessary, and certainly should not be now as
any such portability issues should be tucked away such that the client
code never sees such.
2021-11-19 11:57:16 +09:00
Bill Currie b892ce637a [input] Nuke IN_Move from orbit
gotta be sure :)

On a serious note, it was always a problem in that it had
client-specific code and concepts embedded in the libraries.
2021-11-19 08:58:02 +09:00
Bill Currie fbcb22d41a [qw] Sort out move axis directions and names
Everything is set up so default recipes work as expected (by me) for a
3Dconnexion SpaceNavigator:
    translation axes move quakeguy in the direction the puck is moved
    tilting the puck forward pitches forward (look down)
    tilting the puck to the left rolls to the left
    twisting the puck clockwise (looked at from the top) turns quakeguy
    to the right.

This does mean that the default pitch motion for a regular mouse is now
push forward to pitch forward (look down) (inverted from before).

Mouse scaling is out (too small), but that's because in_amp etc are
ignored for now (thinking about how to integrate cvars with axis
recipes). Joystick input will be the same.
2021-11-16 20:26:19 +09:00
Bill Currie b8baa04b2e [input] Split binding event handler
There's now an internal event handler for taking care of device addition
and removal, and a public event handler for dealing with device input
events in various contexts In particular, so the clients can check for
the escape key.
2021-11-16 12:54:23 +09:00
Bill Currie 1868fe7404 [qw] Save and load cvars before input config
Saving is not so important, but for loading, while the input system
doesn't make much use of cvars at this stage, it makes sense for them to
be loaded before the input system configuration is loaded.
2021-11-16 08:48:35 +09:00
Bill Currie b80c19bd77 [util] Save and load cvars to/from plist configs
Other than some backwards compatibility, this completes the
configuration updates for now.
2021-11-15 22:04:29 +09:00
Bill Currie 8cf0d00eda [qw] Switch quakeforge.cfg to property list format
Cvars aren't handled yet, but input configuration is. Seems to work :)
2021-11-14 10:32:35 +09:00
Bill Currie adaa3c5485 [input] Get bindings actually working
The mouse bound to movement axes works (though signs are all over the
place, so movement direction is a little off), and binding F10 (key 68)
to quit works :)
2021-11-12 00:24:04 +09:00
Bill Currie 6da8a2622f [qw] Create axes for viewdelta
First step in removing IN_Move. Once nq is updated, IN_Move can be
removed entirely.
2021-11-10 15:50:14 +09:00
Bill Currie 925ca8081c [input] Implement imt creation, binding, etc
Much testing is needed, but the bulk of imt management is implemented.
Axis bindings are not properly implemented yet, though.
2021-11-08 16:54:52 +09:00
Bill Currie 4898a44263 [console] Hook up new input system
This has smashed the keydest handling for many things, and bindings, but
seems to be a good start with the new input system: the console in
qw-client-x11 is usable (keyboard-only).

The button and axis values have been removed from the knum_t enum as
mouse events are separate from key events, and other button and axis
inputs will be handled separately.

keys.c has been disabled in the build as it is obsolute (thus much of
the breakage).
2021-11-08 11:20:04 +09:00
Bill Currie fae9e043df [input] Move button name and description
This puts the name and description into the button itself, making it much
easier to look them up.
2021-11-01 13:54:16 +09:00
Bill Currie 665790f562 [video] Remove libQFjs
It is now redundant with the libQFinput, though nothing actually works yet.
2021-11-01 12:30:45 +09:00
Bill Currie 4406be8de3 [input] Move last button declarations
This puts all the client button declarations in the right place (for now:
eventually there will be just the one client input header).
2021-11-01 12:13:28 +09:00
Bill Currie fed8f66824 [input] Rework logical buttons
kbutton_t is now in_button_t and has been moved to input.h. Also, a
button registration function has been added to take care of +button and
-button command creation and, eventually, direct binding of "physical"
buttons to logical buttons. "Physical" buttons are those coming in from
the OS (keyboard, mouse, joystick...), logical buttons are what the code
looks at for button state.

Additionally, the button edge detection code has been cleaned up such
that it no longer uses magic numbers, and the conversion to a float is
cleaner. Interestingly, I found that the handling is extremely
frame-rate dependent (eg, +forward will accelerate the player to full
speed much faster at 72fps than it does at 20fps). This may be a factor
in why gamers are frame rate obsessed: other games doing the same thing
would certainly feel different under varying frame rates.
2021-10-01 09:16:31 +09:00
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 1f57f81a20 [qw] Use set_count to count the pvs/phs leafs 2021-07-27 14:01:08 +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 05fa0538ab [qw] Count leafs correctly for PHS
This fixes some out-by-one bugs caused by there being an obo bug in the
original SV_CalcPHS: space was being allocated for numleafs leafs, but
numleafs does not count the world-surrounding solid leaf 0, but
SV_CalcPHS generates pvs and phs data (just the "everything" set) for
leaf 0, which is later used for broadcasts and the like.
2021-07-27 11:34:17 +09:00
Bill Currie bd2ceca13a [qw] Move the pvs and phs sets into single hunks
Hunk_Alloc has a rather large per-block overhead. Also, small pvs sets
(64 leafs) will fit into just the basic set structure so no need to
allocate data for the maps.
2021-07-26 22:36:07 +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 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 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 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 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
Bill Currie 91eeae5186 [qw] Clean up netgraph somewhat
The renderer's LineGraph now takes a height parameter, and netgraph now
uses cl_* cvars instead of r_* (which never really made sense),
including it's own height cvar (the render graphs still use
r_graphheight).
2021-07-11 10:59:27 +09:00
Bill Currie c4ee7ff68a [qw] Check packet size before checking ping ack
Ping ack (A2A_ACK) is always a 1-byte packet, so check that the A2A_ACK
is the only byte in the packet before passing the packet to the server
list code. Fixes the mysterious dropped packet every 256 packets as the
low eight bits of the packet's sequence number equalled A2A_ACK.
2021-07-11 09:26:05 +09:00
Bill Currie 3c0ad2ca71 [qw] Fix some server status output issues
The uptime display had not been updated for the offset Sys_DoubleTime,
so add Sys_DoubleTimeBase to make it easy to use Sys_DoubleTime as
uptime.

Line up the layout of the client list was not consistent for drop and
qport.
2021-07-11 08:18:02 +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 972b0f8a70 [util] Make sizebuf and msg sizes unisgned
And clean up the mess.
2021-04-04 15:53:53 +09:00
Bill Currie 63e30e6ae0 [win] Fix a handful of small bugs for windows
Only 64-bit windows is tested, and there are still various failures, but
QF is limping along in windows again.

nq-sdl works for sw, and sw32, gl and glsl are mostly black (but not
entirely for gl?),  vulkan is not supported with sdl.

nq-win works for sw and sw32, and sort of for vulkan (very dark and
upside-down?). gl and glsl complain about vid mode,

qw-client-[sdl,win] seem to be the same, but something is wrong with the
console (reading keyboard input).
2021-03-30 20:19:20 +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 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 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 d39adc6a64 Reduce the diff noise for client_state_t.
And add a struct tag. Any added fields are, of course, unused. Most of the
changes are to bring the comments into agreement.
2021-03-25 18:16:12 +09:00
Bill Currie 0a89e88ef3 Clean up some nasty formatting. 2021-03-25 18:15:45 +09:00
Bill Currie bc8e37332c Make qw's cl.players dynamically allocated. 2021-03-25 18:15:28 +09:00
Bill Currie d514d4e465 Bring client_state_t a little closer to matching. 2021-03-25 18:15:02 +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 457306edad [qw] Fix handling of sky box name
The handling was broken during some merge work. Need to find a good way
to unify it all (probably by giving nq a fake serverinfo).
2021-03-25 15:56:01 +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 82e58dae5f [qw] Disable lerping on player model change
This seems to be an ancient bug, but may have been exposed by the recent
entity changes (was certainly highlighted by Vulkan)
2021-03-20 00:08:21 +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 36761192a6 [qw] Partially clean up muzzle flash handling
It needs some more work (see FIXME in the code).
2021-03-11 15:23:35 +09:00
Bill Currie ca38f9b616 [qw] Use entity_state_t as a base for player_state_t
This will, in the long run, help clean up a lot of the differences in
the handling of entities in the clients.
2021-03-11 14:27:36 +09:00
Bill Currie c9bbc2971a [qw] Rename view_message to view_state
Makes more sense to me.
2021-03-11 12:47:08 +09:00
Bill Currie abaccbec53 [client] Move qw's loc code into client
This makes the location code available to nq (not used yet) but more
importantly moves some definitely client-side code into the right place.
2021-03-11 11:53:38 +09:00
Bill Currie b8267f2edd [client] Merge nq/qw entity effects code 2021-03-11 11:25:04 +09:00
Bill Currie 51e8694195 [qw] Use a dynamic array to track static entities
This takes care of another fixme in the cleanup of entity_t.
2021-03-11 09:11:08 +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 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 7970525ef4 [util] Make va thread-safe
It now takes a context pointer (opaque data) that holds the buffers it
uses for the temporary strings. If the context pointer is null, a static
context is used (making those uses of va NOT thread-safe). Most calls to
va use the static context, but all such calls have been formatted
consistently so they are easy to find when it comes time to do a full
audit.
2021-01-31 16:05:48 +09:00
Bill Currie 6e636a27d0 [renderer] Continue the job of merging SCR_UpdateScreen
I think this is probably as merged as it will get (though the update
callbacks can probably do with some merging).
2021-01-11 16:57:31 +09:00
Bill Currie ab04a1915e [build] Fix a pile of gcc 10 issues
gcc got stricter about array accesses, complicating progs macros, and
much better at detecting buffer overflows.
2020-12-21 14:14:29 +09:00
Bill Currie 86b5b30b45 Merge branch 'master' into vulkan 2020-06-25 14:03:52 +09:00
Bill Currie 6d5ffa9f8e [build] Move to non-recursive make
There's still some cleanup to do, but everything seems to be working
nicely: `make -j` works, `make distcheck` passes. There is probably
plenty of bitrot in the package directories (RPM, debian), though.

The vc project files have been removed since those versions are way out
of date and quakeforge is pretty much dependent on gcc now anyway.

Most of the old Makefile.am files  are now Makemodule.am.  This should
allow for new Makefile.am files that allow local building (to be added
on an as-needed bases).  The current remaining Makefile.am files are for
standalone sub-projects.a

The installable bins are currently built in the top-level build
directory. This may change if the clutter gets to be too much.

While this does make a noticeable difference in build times, the main
reason for the switch was to take care of the growing dependency issues:
now it's possible to build tools for code generation (eg, using qfcc and
ruamoko programs for code-gen).
2020-06-25 11:35:37 +09:00
Bill Currie 4cef9792f4 [util] Make hash-tables semi-thread-safe
They take a pointer to a free-list used for hashlinks so the hashlink
pools can be per-thread. However, hash tables that are not updated are
always thread-safe, so this affects only updates. progs_t has been set
up such that it is easy for multiple progs within one thread can share
hashlinks.
2020-03-25 15:43:16 +09:00
Bill Currie d0c8d75e92 Clean up unnecessary includes of signal.h 2020-03-23 16:18:08 +09:00
Bill Currie 88b4046632 [util] Pass a data pointer to shutdown functions
And clean up the mess.
2020-03-22 00:57:54 +09:00
Bill Currie ae70efcaf5 [qw] Clean up a comment 2020-03-21 16:27:53 +09:00
Bill Currie 1a7add3f6d Merge branch 'master' into vulkan 2020-03-20 13:04:41 +09:00
Bill Currie 6739f5df4d Fix an out-by-one error
Noticed while sorting out pr_argc
2020-02-25 17:39:34 +09:00
Bill Currie a55b9544ac Improve handling of pr_argc
It is now set to 0 when progs are loaded and every time
PR_ExecuteProgram() returns. This takes care of the default case, but
when setting parameters, pr_argc needs to be set correctly in case a
vararg function is called.
2020-02-25 17:36:29 +09:00
Bill Currie 4b7ecdf74a Make PR_Init take an instance to initialize
This allows internal sub-systems to do per-instance initializations
without other engine systems having to know about them.
2020-02-23 18:32:16 +09:00
Bill Currie 81083698a8 Move to using an in-memory form of ddef_t
This allows the VM to work with extended ddefs transparently. It seems
to have uncovered a typedef alias relocation bug, though.
2020-02-22 22:33:44 +09:00
Bill Currie 9ff4eefe65 Merge branch 'master' into vulkan 2020-02-16 18:17:50 +09:00
Bill Currie df7c08a010 Add support for doubles to Ruamoko
Only as scalars, I still need to think about what to do for vectors and
quaternions due to param size issues. Also, doubles are not yet
guaranteed to be correctly aligned.
2020-02-15 23:49:12 +09:00
Bill Currie 4e4d1b99b4 Clean up all the system shutdown calls
I added Sys_RegisterShutdown years ago and never really did anything
with it: now any system that needs to be shutdown can ensure it gets
shutdown on program exit, and in the correct order (ie, reverse to init
order).
2019-07-12 23:15:26 +09:00
Bill Currie 3e1520c246 Move vid callback access into vid
The plan is to move the callbacks into a "private" struct.
2019-07-08 12:46:22 +09:00
Bill Currie 82809eb856 Simplify the call to PR_LoadProgsFile.
I've decided that setting pr.max_edicts and pr.zone_size as part of the
local progs initialization rather than in PR_LoadProgsFile makes more
sense. For one, it is unlikely for the limits to change every time progs is
reloaded. Also, they seem to be a property of the VM rather than the progs.
However, there is nothing stopping the caller from updating max_edicts and
zone_size every call.
2018-10-11 10:06:48 +09:00
Bill Currie 34bcf7faab Do a pure/const/noreturn/format attribute pass.
I always wanted these, but as gcc now provides warnings for functions that
could do with such attributes, finding all the functions is much easier.
2018-10-09 12:42:21 +09:00
Bill Currie 59e85b7d5e Fix a pile of dead assignments.
Some were actual bugs!
2018-09-08 22:23:57 +09:00
Bill Currie 8fd5be0ee0 Fix a pile of sizeof goofs.
While scan-build wasn't what I was looking for, it has proven useful
anyway: many of the sizeof errors were just noise, but a few were actual
bugs (allocating too much or too little memory).
2018-09-07 20:00:57 +09:00
Bill Currie 4f58429137 Fix an unhealthy pile of gcc 8 warnings.
While some of the warnings were merely annoying, some where actual bugs or
unearthed bugs in related code.
2018-08-20 00:05:00 +09:00