Commit graph

1827 commits

Author SHA1 Message Date
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
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
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