Commit Graph

1876 Commits

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