Commit Graph

12240 Commits

Author SHA1 Message Date
Bill Currie 1859ff233d [client] Fix the chase cameras
They no longer spin like crazy. I don't know how, but I must have broken
something over the years as I'm sure Seth had the code working (and I
seem to remember seeing it working). In the process, clean up a lot of
the angle mess.
2022-03-01 14:44:53 +09:00
Bill Currie 5b08ee768c [client] Clean up chase camera code
It's a lot easier to read (and see the difference between modes 2 and 3)
with all the ifs removed, and the state is properly is chasestate_t now
(though not handled properly on level reset etc).
2022-03-01 13:49:14 +09:00
Bill Currie 43a329dcb5 [client] Get the basic chase camera working
The more advanced modes are rather broken (continuous spinning), but
they may have been for a while. The bulk of the various changes were due
to renaming viewstate's origin and angles to make their meaning more
explicit.
2022-03-01 11:43:23 +09:00
Bill Currie fb83d87a0e Fix some distcheck issues
Just keeping up with myself.
2022-03-01 10:12:50 +09:00
Bill Currie 457c73967b [sound] Correct "default" listener origin
Position vectors need to be homogeneous, I forgot that when doing the
change.
2022-03-01 01:02:11 +09:00
Bill Currie 57dd4494cc [renderer] Pass in a camera transform
More r_data cleanup. Things could be better still, but this is a start.
2022-02-28 16:59:38 +09:00
Bill Currie ca9e8a3b68 [client] Pass time into locs_draw
This avoids unnecessary access to r_data.
2022-02-28 16:57:43 +09:00
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 e920abe142 [glsl] Adjust view/projection matrices for consistency
The actual view and projection matrices are now consistent with vulkan,
with the vulkan-gl disparity moved into adjustment matrices. The goal is
to allow the same camera data and code to be used in all renderers. The
extra matrix multiplication shouldn't be too expensive as it occurs only
when the field of view (not often, under user control) or near and far
clip distances (very rarely) change.
2022-02-25 10:50:53 +09:00
Bill Currie 5ad7c0fbd6 [scene] Add a camera object
It holds the data for a basic 3d camera (transform, fov, near and far
clip). Not used yet as there is much work to be done in cleaning up the
client code.
2022-02-25 10:41:50 +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 2615953e17 [scene] Move transform getters into inline functions 2022-02-21 08:33:41 +09:00
Bill Currie e67ec84db9 [vulkan] Use simpler projection and z_up matrices
While both matrices had positive determinants in the first place, I find
the projection matrix easier to understand without all the negatives,
and having quake-x/vulkan-z positively parallel in the z-up matrix makes
that a lot easier to think about.
2022-02-18 14:25:50 +09:00
Bill Currie cd26073b6a [vulkan] Update the sky matrix
Regardless of whether the sky is spinning or not, the matrix needs to be
updated with the current origin in order to get the direction vector
right in the shader. Also, it's in the update that the required x-y
plane rotation gets in so the skies move in the correct direction.
2022-02-18 13:29:41 +09:00
Bill Currie 981fcca76d [sw,sw32] Fix broken software skies
All for an unfortunate unsigned promotion. I guess I just wasn't testing
the software renderers enough.
2022-02-18 12:54:54 +09:00
Bill Currie d75726dd22 [vulkan] Bind the correct texture for sky boxes
That took way too long to find: just couldn't see it for looking.
2022-02-18 01:17:25 +09:00
Bill Currie 2d2f14cd31 [vulkan] Fix incorrect bsp sky constant ids
I guess I got things a little tangled when cleaning up my bindless
attempt.
Fixes black default skies.
2022-02-18 01:15:38 +09:00
Bill Currie 70af362562 [qfcc] Unify temp def, return value and parameter sizes
In working with vectors and matrices while testing the scene wrappers, I
found that there was a fair bit of confusion about how large something
could be. Return values can be up to 32 words (but qfcc wasn't aware of
that), parameters were limited to 4 words still (and possibly should be
for varargs), and temp defs were limited to 8 words (1 lvec4). Temps are
used for handling return values (at least when not optimizing) and thus
must be capable of holding a return value, and passing large arguments
through *formal* parameters should be allowed. It seems reasonable to
limit parameter sizes to return value sizes.

A temp and a move are still used for large return values (4x4 matrix),
but that's an optimization issue: the code itself is at least correct.
2022-02-15 08:39:20 +09:00
Bill Currie 4f436e8245 [scene] Correct a comment
While the plethora of orientations for a reference frame is somewhat
annoying, having an incorrect description of the frame is much more
annoying.
2022-02-15 06:46:01 +09:00
Bill Currie 54f0af854b [ruamoko] Wrap the transform fuctions
Except for get/set name as I'm still pondering strings.
2022-02-15 00:06:39 +09:00
Bill Currie ba3879c6e0 [scene] Make transforms owned by the scene
This actually has at least two benefits: the transform id is managed by
the scene and thus does not need separate management by the Ruamoko
wrapper functions, and better memory handling of the transform objects.
Another benefit that isn't realized yet is that this is a step towards
breaking the renderers free of quake and quakeworld: although the
clients don't actually use the scene yet, it will be a good place to
store the rendering information (functions to run, etc).
2022-02-14 20:01:36 +09:00
Bill Currie f0c35e541a [ruamoko] Pass some more purity tests
Separate because I want to cherry-pick the other commit.
2022-02-14 19:56:56 +09:00
Bill Currie e58d53d4b6 [gamecode] Pass gcc's purity test again
I guess maybe that change might make a bigger difference than I thought,
gcc wasn't happy with it.
2022-02-14 19:30:50 +09:00
Bill Currie 59044d3827 Fix a bunch of distcheck issues 2022-02-14 19:28:19 +09:00
Bill Currie afbca54faf [ruamoko] Add wrappers for the existing scene functions
I've run into a bit of an issue with transform management (really, just
need to make them owned by the scene, but that means creating a scene
for quake and quakeworld).
2022-02-14 16:43:10 +09:00
Bill Currie f6ac614e09 [scene] Add functions for scene and entity create/delete
Scene creation was already there, but now can be deleted, as can
entities.
2022-02-14 16:41:38 +09:00
Bill Currie f3559cedb0 [qwaq] Plug a file handle leak
Forgot to call Qclose in load_file.
2022-02-14 14:41:14 +09:00
Bill Currie 4d491a444d [gamecode] Fix handling of undefined builtins
The setup of the function descriptor for undefined builtins was
incomplete and led to the progs running code at address 0. It didn't end
well.
2022-02-14 14:28:19 +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 c6aa061229 [qwaq] Fetch Ruamoko progs locals from the stack frame
Now that the data is fetched from the correct location, the locals view
is useful again :). However, there seems to be a problem with array
views: not sure they're showing the correct data as I was getting
unexpected values in the display but normal vars seem to be ok.
2022-02-12 10:19:45 +09:00
Bill Currie 39583a959e [qwaq] Show only user local defs
While the .tmp defs weren't too much clutter in v6p progs, the .arg defs
in Ruamoko progs make for a lot of noise. Showing only user defs (those
without a leading .) makes for a much more usable locals display.
2022-02-12 10:19:21 +09:00
Bill Currie 944a9253e9 [gamecode] Support %u format in PR_Sprintf
Not sure why it was missed as it would have been useful even before
unsigned was properly supported by qfcc.
2022-02-12 01:58:38 +09:00
Bill Currie fc8cc0b703 [zone] Be more informative when catching memory errors
The registered error handler is given a chance to report the error, and
the corrupted id is printed.
2022-02-12 01:57:03 +09:00
Bill Currie 1d26c727a3 [ruamoko] Allocate selectors in large blocks
The zone memory block header is 64 bytes, so allocating a single 8 byte
selector is rather wasteful. Instead, allocate selectors in large chunks
(currently 64) and divvy them out as needed. Significantly reduces
memory pressure in large Ruamoko progs.
2022-02-12 01:52:35 +09:00
Bill Currie 2f117dd12e [qfcc] Record referenced def in pointer dereferences
When the def can be found. This fixes direct assignments to arrays (and
probably structs) getting lost when the array is later read using a
variable index.
2022-02-11 19:29:33 +09:00
Bill Currie 246518f487 [qfcc] Get reused type names working for local variables
This allows the likes of "id id;" or

    typedef int foo; ... { double foo; }

So long as the redeclaration is in a sub-scope.
2022-02-07 10:40:26 +09:00
Bill Currie 748661eb77 Merge branch 'wip-new_instruction_set'
While there is still plenty of improvement to go (mostly in qfcc to take
advantage of the new features, but there's room for optimization in the
VM), the Ruamoko ISA seems to be working quite well.
2022-02-06 21:26:15 +09:00
Bill Currie 76a35c0352 [qfcc] Always test float against 0 for Ruamoko
Float is not int, and Ruamoko has only int ifz/ifnz, which will fail for
-0.0 (0x80000000 when viewed as an int). And then there's nan, but I
haven't seen too many of those in quake.
2022-02-06 21:20:00 +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 548b7fe753 [qfcc] Set function file and line when building code
I suspect this is an ancient bug that wasn't noticed due to not looking
at progs.src compiled code enough, but it makes the first statements of
the function point to the correct line instead of a forward declaration.
2022-02-06 21:20:00 +09:00
Bill Currie abe43584ff [qfcc] Create vector component symbols for parameters
This got lost when the stack frame setup was converted for Ruamoko.
2022-02-06 21:20:00 +09:00
Bill Currie 211cd657e0 [qfcc] Alias entity to int for comparison
The ruamoko ISA has no entity comparison operators because an entity is
just an int in disguise.
2022-02-06 21:20:00 +09:00
Bill Currie afe8c8fca5 [qfcc] Auto-demote double for vector scaling
This was missed in the switch to an explicit scale instruction.
2022-02-06 21:20:00 +09:00
Bill Currie 5f6e0767d7 [qfcc] Make the meaning of vec * vec selectable
Currently only via pragma (not command line options), but I needed to
test the concept. Converting legacy code is just too error prone.
Telling the compiler how to treat the operator makes more sense. When *
acts as @dot with Ruamoko progs, the result is automatically aliased as
a float as this is the legacy meaning (ie, float result for dot
product).
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