Commit Graph

3933 Commits

Author SHA1 Message Date
Bill Currie 35c9d6ee38 Make pr_obcode.c mostly thread safe
Its public data is all read-only, and once set up, its private data is
too (just don't call init in multiple threads).
2020-02-26 01:20:28 +09:00
Bill Currie 3577d27a45 Move the ObjQC data into a resource block
This makes it nice and private (though with the cached pointer, ObjQC is
still a first-class component).
2020-02-25 23:14:18 +09:00
Bill Currie 66dd3ef070 Make a bunch of count things positive-only
This fixes a pile of FIXMEs, because some things should never be
negative.
2020-02-25 21:23:13 +09:00
Bill Currie 282132958f Relocate local def type encodings in debug load
For technical reasons (programmer laziness), qfcc does not fix up local
def type encodings when writing the debug symbols file (type encoding
location not readily accessible).
2020-02-25 20:46:01 +09:00
Bill Currie 89e83d7d73 Move the debug info out of progs_t
The debug subsystem now uses the resources system to ensure it cleans
up, and its data is now semi-private. Unfortunately, PR_LoadDebug had to
remain public for qfprogs because using PR_RunLoadFuncs would cause
builtin resolution to complain.
2020-02-25 20:07:29 +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 e3953be8f8 Ensure execution state is initialized on progs load 2020-02-25 15:25:10 +09:00
Bill Currie 61d7f4f9c4 Dump locals stack when dumping main stack
Any shutdown functions in progs will need locals too.
2020-02-25 15:18:15 +09:00
Bill Currie 6a4ef598ab Allow progs num_edicts and reserved_edicts to be null
Really, while there are edict related instructions, edict support should
probably not be in the VM itself.
2020-02-25 15:00:33 +09:00
Bill Currie 6e56c9a4aa Ensure edict_parse is reset on progs load
A server switching from a game that sets edict_parse to one that does
not could go badly when it comes time to loading a level.
2020-02-25 14:40:03 +09:00
Bill Currie 9bb68f2d8c Allow nested use of PR_SaveParams()
PR_SaveParams() is required for implementing the +initialize diversion
used by Objective-QuakeC because builtins do not have local def spaces
(of course, a normal stack calling convention would help). However, it
is entirely possible for a call to +initialize to trigger another call
to +initialize, thus the need for stacking parameter stashes. As a
bonus, this implementation cleans up some fields in progs_t.
2020-02-25 14:30:26 +09:00
Bill Currie 99c818adcc Ensure progs zone is always set on load 2020-02-25 00:25:24 +09:00
Bill Currie 256dee98a1 Make progs string resources management private
Strangely enough, using the progs resources system. This is a step
towards having progs that can be reset properly, or even dynamically
created VMs.
2020-02-25 00:23:08 +09:00
Bill Currie 3720956d88 Speed up two of the three deletion cases
The initial code was pretty much a port of the code in the editor I
wrote 25 years ago. Either I didn't think of the optimization back then,
or I tried to implement it, failed, and figured it wasn't worth it
(despite using it on a 386dx33). However, I noticed it now and it was
easy enough to get working, and it's always good to not do something
that's not needed.
2020-02-24 18:52:46 +09:00
Bill Currie f7493fe8fb Add a buffer-gap text buffer
This should be good for text editing and working with text files in
general.
2020-02-24 17:30:33 +09:00
Bill Currie 7406e0308e Fix some warnings picked up in an optimized build 2020-02-24 11:28:43 +09:00
Bill Currie dda045bf96 Do lazy computation of def sizes from type encodings
The size is calculated when needed and cached.
2020-02-23 23:29:58 +09:00
Bill Currie 23573953a7 Change pr_type_size to pr_ushort_t 2020-02-23 22:25:08 +09:00
Bill Currie c3c55f0bcc Fix some source formatting 2020-02-23 19:05:43 +09:00
Bill Currie d0dc0e15fb Handle alias types in debug prints 2020-02-23 19:02:16 +09:00
Bill Currie b173c35eb4 Rework progs debug to use the type encodings
It's only a start: the output is, if anything, slightly worse than
before, but it does have the basics going.
2020-02-23 19:01:59 +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 f8b1a3a89f Return the previous sys print callbacks
This allows for temporary overrides.
2020-02-23 11:41:19 +09:00
Bill Currie 806af85447 Remove reference to ddef_t from progs.h
This cleans up some horrible names and redundant fields that were a
result of the transition to pr_def_t
2020-02-22 22:44:08 +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 c296514b95 Make pr.load_file 'return' the file size 2020-02-21 21:17:28 +09:00
Bill Currie 2db5d04e3f Reduce the ephemeral nature of str_mid
When the substring is the tail of the supplied string, return a
"pointer" to within the supplied string rather than a new "return"
string. This means that tail-end substrings of string constants are
themselves constants.
2020-02-19 21:41:46 +09:00
Bill Currie ed283a9e7f Copy only the necessary number of vararg parameters 2020-02-16 18:00:29 +09:00
Bill Currie 12d2a0ff75 Copy the correct number of words for rcall 2020-02-16 17:58:36 +09:00
Bill Currie f5741a979e Implement parameter alignment in the engine
The engine now requires non-v6 progs to store the log2 alignment for the
param struct in .param_alignment.

PR_EnterFunction is clearer and possibly more efficient.
2020-02-16 17:13:45 +09:00
Bill Currie 32c21ec559 Make gcc accept the bitwise-boolean magic
Forgot to compile check...
2020-02-16 12:08:08 +09:00
Bill Currie b4fd804e4e Implement true modulo in the engine 2020-02-16 11:53:56 +09:00
Bill Currie 4269c8cb07 Rename the mod instruction to rem
Because % really implements remainder rather than true modulo, and I
plan on adding %% to implement true modulo.
2020-02-16 11:04:30 +09:00
Bill Currie bab3752e98 Add missed overridden math functions
And fix misspelled ones too.
2020-02-15 23:49:12 +09:00
Bill Currie 533fb8acc9 Implement double constants 2020-02-15 23:49:12 +09:00
Bill Currie 2cd62fe01b Fix several double-related bug
float is promoted to double through ... for non-v6 code.
PR_Sprintf has custom param access via P_*, messed up doubles.
2020-02-15 23:49:12 +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 13b608f40c Don't truncat float % float
This allows full usage, eg, x % pi, but otherwise maintains
compatibility with integer %
2020-02-15 23:49:12 +09:00
Bill Currie de64be1d67 Show more info when dumping x11 video modes
Found in an old stash. Probably the start of xrandr support.
2020-02-12 11:04:28 +09:00
Bill Currie 9248e8cf01 Update for doxygen 1.8.16 2020-02-11 15:22:42 +09:00
Bill Currie 6ce87497f3 Fix a potential buffer overflow
Highly unlikely to have that many sub models, but it does keep gcc
quiet.
2020-02-06 17:42:21 +09:00
Bill Currie 302a462c32 Make SetMouse timeout after 2 seconds
This makes sure that some unchecked event doesn't cause a lockup.
However, blocking input is really not the way to go: need to implement a
state machine and use non-blocking event reads.
2019-07-10 22:28:33 +09:00
Bill Currie 980cf58ac5 Wait for the window to be visible before mouse warping
This fixes the hang during fullscreen startup on my system (the motion
events weren't being generated because there was no window to see the
motion).
2019-07-10 22:28:33 +09:00
Bill Currie a4f963f67b Add a cvar to block use of x11 vidmode
Or really, allow it if the user specifically requests it: the default is
blocked. Modern systems (particularly displays) do not really like
changing resolution, so doing so by default seems rather wrong.
2019-07-10 22:28:33 +09:00
Bill Currie c727f6a130 Rewrite QuatMultVec to be faster
Could be faster still using SSE, but that's another project.
2019-07-06 14:45:40 +09:00
Bill Currie f68129dc0f Try to use type encodings for function return type
Now return statements in traces make much more sense.
2019-06-09 18:11:56 +09:00
Bill Currie 0f5f2a125a Use a reliable reference for calculating progs offsets.
Now that pr->zone can be null, it cannot be used as a reference. Fixes
random crashes when using qfprogs (random due to heap randomization).
2018-10-13 23:23:45 +09:00
Bill Currie f58c2fef5a Switch QF's quaterions from wxyz to xyzw.
After messing with SIMD stuff for a little, I think I now understand why
the industry went with xyzw instead of the mathematical wxyz. Anyway, this
will make for less pain in the future (assuming I got everything).
2018-10-12 14:33:55 +09:00
Bill Currie b7aa5bb8fe Fix an oops messing up edict size. 2018-10-12 14:33:26 +09:00
Bill Currie 33cbc500e8 Fix a segfault when setting up the stack.
Yup, putting {}s around even single statements under flow control (if, etc)
is a good idea. Wonder if there's a gcc warning for that...
2018-10-11 13:34:08 +09:00
Bill Currie 6252faa069 Fix a size error in OP_LOAD_Q.
C&P from OP_LOAD_V :/
2018-10-11 13:25:32 +09:00
Bill Currie 364c2d2c2b Add a stack and push and pop instructions.
The stack is for data, not return addresses.
2018-10-11 13:24:03 +09:00
Bill Currie 61185813fa Cleaner handling of zone_size/zone. 2018-10-11 10:22:10 +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 6f28ab2a68 Add basic quaternion multiplication tests. 2018-10-09 12:44:46 +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 db3df6f8a7 Fix a bunch of dead increments. 2018-09-09 11:12:04 +09:00
Bill Currie 3f638d95ba Remove a possibly spurious break.
I'm not certain despair actually meant for the break to be there. It
certainly would have sped up the game a bit but at the expense of proper
blood trails in the software renderers.
2018-09-09 10:54:38 +09:00
Bill Currie 62793b2dc2 Fix some potentially garbage assignments.
These are the ones where I could easily make scan-build happy. They do seem
to be potential holes where invalid data in one place could result in use
of uninitialized values.
2018-09-09 09:54:16 +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 f75ff2d269 Fix some null argument issues. 2018-09-07 22:30:44 +09:00
Bill Currie 1eb1622420 Fix some strncat issues. 2018-09-07 21:27:34 +09:00
Bill Currie 8f028b8a0d Fix some double frees. 2018-09-07 20:03:19 +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 575a67b2a1 mat4 test case fixes.
The tests cases themselves were buggy.
2018-08-26 15:06:08 +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
Bill Currie 0de0eb2fc7 Fix a bunch of bit-rot. 2018-06-08 13:21:30 +09:00
Bill Currie 2329fb1885 Fix some warnings and bitrot. 2016-10-25 00:10:30 +09:00
Bill Currie f163e35f21 Add a builtin to get keydown. 2016-01-10 13:33:05 +09:00
Bill Currie 1ea74c6269 Fix the gl skin segfault.
This was caused by an out-by one error when setting up the skin: if cmap
was 0 then the gl_skin struct would be taken from index -1 of the array and
thus cause all sorts of grief.
2016-01-04 22:04:39 +09:00
Bill Currie 9cb23ba67e Clean up some error messages.
The contractions took the emphasis off where it needed to be.
2016-01-04 16:12:36 +09:00
Bill Currie aecea5c350 Document most of they key binding system. 2016-01-04 16:11:15 +09:00
Bill Currie 59f60d1ba7 Enable the Key_StringToKeynum builtin.
I don't know why I didn't do it earlier other than lack of need.
2016-01-04 16:10:22 +09:00
Bill Currie 7c16acf4aa Make Key_GetBinding take an imt instead of a name. 2016-01-04 16:06:48 +09:00
Bill Currie 546e333a3c Allow Sys_Error to be hooked.
This makes debugging builtins that wrap normal functions a little easier by
giving a progs dump when such an error occurs.
2016-01-03 23:04:00 +09:00
Bill Currie 735fcf68d5 Clean up usage of va_copy.
AC_TYPE_VA_LIST is no longer necessary, and the code is easier to read.
2016-01-03 21:16:23 +09:00
Bill Currie 2cbb7cb0c8 Remove a redundant va_start/va_end pair.
Found while checking how many places use va_copy.
2016-01-03 18:38:41 +09:00
Bill Currie 61c6a4b68e Include config.h in model tests.
The gcc inlining changes made it necessary.
2016-01-03 16:18:14 +09:00
Bill Currie 7b350b2a1b Indicate calls to builtins when tracing.
This makes following progs traces a little easier.
2016-01-03 16:13:59 +09:00
Bill Currie 331b054d4a Fix an inappropriate reuse of a variable.
Using "ax"is for the joystick "var"iable is a bit confusing.
2015-06-18 21:22:31 +09:00
Jeff Teunissen 890c83ff6e Fix crash in classic GL
GL sometimes crashes when building skins. This probably isn't the correct
fix (finding the situation where fb->tex can become NULL despite fb being
non-null is), but it does kill the segfault. Luckily, this is git and this
commit can just be reverted when the real fix shows up. :)
2014-10-16 13:45:39 -04:00
Bill Currie d1f1375df5 Increase number of supported joystick buttons.
Also fix a bug where despite supporting 32 buttons, only 18 were actually
supported, and a similar issue for the number of axes.

My saitek x52 has 34 buttons and 10 axes. Whee.
2014-08-17 11:35:40 +09:00
Johnny d1a8c1b277 Color swizzle & software lighting fix 2014-02-03 16:20:54 +09:00
Bill Currie d80342e0a8 Fix some compile errors from Johnny's patch.
Turns out he has to compile without -Werror.
2014-02-02 16:42:08 +09:00
Johnny 850382eed4 Fixes crashes when sw32_r_pixbytes is set to 2 or 4 2014-02-02 16:22:53 +09:00
Bill Currie 9d71d9bb7a Remove maxwarpwidth and maxwarpheight.
Only the sw32 renderer even tried to use them, and they didn't get set
properly. This fixes JohnnyonFlame's waterwarp issue.
2014-02-02 14:41:58 +09:00
Bill Currie 946561ba44 Don't bail out prematurely when searching for files.
This fixes the problem of not finding files without a .gz extension when
gzip support is enabled (most of my quake data is compressed, so it took a
while for me to notice the problem).
2014-01-29 16:13:24 +09:00
Bill Currie 99678a571b Remove *.slc on make clean. 2014-01-28 16:26:24 +09:00
Bill Currie ab3f554a0e Limit the search for lit and ent files.
The search for these files will stop in the vpath that contains the .bsp
file to which they belong. This will prevent problems with
id1/maps/start.lit being used for shadows/maps/start.bsp.
2014-01-28 16:22:05 +09:00
Bill Currie 8bea6a66ca Create _QFS_VOpenFile and QFS_VOpenFile.
_QFS_VOpenFile is actually _QFS_FOpenFile reimplemented to take vpath start
and end parameters so the search can be limited. QFS_VOpenFile,
_QFS_FOpenFile, and QFS_FOpenFile are all wrappers for _QFS_VOpenFile.
2014-01-28 16:22:05 +09:00
Bill Currie 3efb0c538f Separate file search from loading.
QFS_LoadFile (and its wrappers) now  take a file handle rather than a
path. This will make vpath usage a little cleaner to implement.
2014-01-28 16:22:05 +09:00
Bill Currie 328b997843 Save the vpath in the model.
This will be used for restricting searches for auxiliary model files.
2014-01-28 16:22:05 +09:00
Bill Currie 83c47aacef Remove the stack loading from QFS_LoadFile. 2014-01-28 16:22:05 +09:00
Bill Currie a561477274 Nuke QFS_LoadStackFile().
It was used in only one place and is really not necessary (these days,
anyway).
2014-01-28 16:22:05 +09:00
Bill Currie 25a060f369 Remove the foundname param from _QFS_FOpenFile.
It's now obsolete with qfs_foundfile.
2014-01-28 16:22:05 +09:00
Bill Currie 576c73cf7c Replace qfs_file_from_pak with qfs_foundfile.
This exposes the found name, vpath and in_pak status.
2014-01-28 16:22:05 +09:00
Bill Currie e5148493db Prepend qfs_ to file_from_pak.
A little better name-spacing.
2014-01-28 16:22:05 +09:00
Bill Currie 82ded3fbe5 Fix some bitrot resulting from a rebase. 2014-01-28 16:22:05 +09:00
Bill Currie 5560696a65 Fix some unused variables. 2014-01-28 16:22:05 +09:00
Bill Currie 4b18501b00 Fix an uninitialized variable. 2014-01-28 16:22:05 +09:00
Bill Currie 40206904ba Reimplement _QFS_FOpenFile using QFS_FindFile's internals.
_QFS_FOpenFile does a full search, however.
2014-01-28 16:22:05 +09:00
Bill Currie 6b87ddbb7c Add QFS_FindFile.
QFS_FindFile's search can be constrained to begin or end at a certain
vpath.
2014-01-28 16:22:04 +09:00
Bill Currie 8bc2f7f6df Print the vpath name when dumping the paths. 2014-01-28 16:22:04 +09:00
Bill Currie 098821e35d Fix QFS_FilelistFill to work with vpaths. 2014-01-28 16:22:04 +09:00
Bill Currie f05c7179c3 Split up the search paths into vpath chunks.
A vpath is the union of all locations searched for a file in a single
gamedir (eg, shadows, id1 etc). This is a necessary step to preventing
problems like id1/maps/start.lit being used for shadows/maps/start.bsp.

However, QFS_FilelistFill still needs to be reworked as it does not compile
yet (testing was done with a gutted QFS_FilelistFill).
2014-01-28 16:22:04 +09:00
Bill Currie 6910c50a43 Clean up the #ifdef mess in _QFS_FOpenFile
With proper initialization, only the one chunk of #ifdefs is needed. Now
the code is much easier to read.
2014-01-28 16:22:04 +09:00
Bill Currie 4d59282641 Find the remaining vertex attribute order issues.
I hope. I do need to figure out why I made sprite blend an attribute
rather than a uniform.
2014-01-28 16:22:04 +09:00
Bill Currie a5db0b1a65 Remove the now unnecessary GLSL_CompileShaderS().
Now that the transition to using shader effects is comlete, there's no
need for the wrapper.
2014-01-28 16:22:04 +09:00
Bill Currie 57d2198140 Use the new shader system for iqm models. 2014-01-28 16:22:04 +09:00
Bill Currie 385175ca65 Use the new shader system for 2d drawing. 2014-01-28 16:22:04 +09:00
Bill Currie c89e612cd4 Remove redundant fog and palette shader code. 2014-01-28 16:22:04 +09:00
Bill Currie 50bb40be29 Use the new shader system for sprites. 2014-01-28 16:22:04 +09:00
Bill Currie 68bd7e643d Remove the long dead text vertex shader. 2014-01-28 16:22:04 +09:00
Bill Currie 1d67f8f0c3 Use the new shader system for textured particles. 2014-01-28 16:22:04 +09:00
Bill Currie 1a7b532927 Use the new shader system for point particles. 2014-01-28 16:22:04 +09:00
Bill Currie 3af6a640fe Missed the old turb frag shader. 2014-01-28 16:22:04 +09:00
Bill Currie a419fb2c92 Ensure the vertex coord attribute is attribute 0.
It seems mesa still has the bug where non-array attributes don't work
when set as attribute 0, and that the allocation order changed sometime
since I last tested with mesa. This fixes the black world and flickering
alias models on my eeepc.
2014-01-28 16:22:04 +09:00
Bill Currie 042d6e5728 Remove a couple of stale files.
Missed these in the bsp related commit.
2014-01-28 16:22:04 +09:00
Bill Currie 26fc0b74e6 Fix bsp water surfaces.
Everything seems to be working for the bsp renderer.
2014-01-28 16:22:04 +09:00
Bill Currie f43592589d Use the new shader system in the bsp renderer.
It mostly works. Skybox is untested, and water surfaces are broken.
2014-01-28 16:22:04 +09:00
Bill Currie b269338947 Start using the new shader system.
So far, alias model rendering is the only victim, but things are working,
even if only color map lookup and fog blending are broken out at this
stage.

I expect the effect naming scheme will go through some changes until I'm
happy with it.
2014-01-28 16:22:04 +09:00
Bill Currie 323fbe1927 Fix an allocation oopsie.
I must have been tired when I wrote that line.
2014-01-28 16:22:04 +09:00
Bill Currie 550f1ae788 Fix some bitrot.
Just updating for the changes to the ALLOC/FREE macros.
2014-01-28 16:22:03 +09:00
Bill Currie 96c40cb9a1 Add basic support for shader "effects".
Again, based on The OpenGL Shader Wrangler. The wrangling part is not used
yet, but the shader compiler has been modified to take the built up shader.
Just to keep things compiling, a wrapper has been temporarily created.
2014-01-28 16:22:03 +09:00
Bill Currie 3b56f0e3bf Advance src with next_line.
This fixes the double counting of the \n at the end of the chunk separator
line.
2014-01-28 16:22:03 +09:00
Bill Currie d1848a93c8 Add tests for chunk line numbers.
Which happen to find errors :P
2014-01-28 16:22:03 +09:00
Bill Currie d912970cd3 Add support for segmented text files.
The idea comes from The OpenGL Shader Wrangler
(http://prideout.net/blog/?p=11). Text files are broken up into chunks via
lines beginning with -- (^-- in regex). The chunks are optionally named
with tags of the form: [0-9A-Za-z._]+. Unnamed chunks cannot be found.
Searching for chunks looks for the longest tag that matches the beginning
of the search tag (eg, a chunk named "Vertex" will be found with a search
tag of "Vertex.foo"). Note that '.' forms the units for the searc
("Vertex.foo" will not find "Vertex.f").

Unlike glsw, this implementation does not have the concept of effects keys
as that will be separate. Also, this implementation takes strings rather
than file names (thus is more generally useful).
2014-01-28 16:22:03 +09:00
Bill Currie 4c6478c77f Strip trailing spaces from field names.
A certain mod (glare at rogue) has a space at the end of a field name in
the bsp entity data causing a crash. Thanks to ccr for the report.
2013-11-26 14:27:49 +09:00
Bill Currie f5501fbf24 Fix a pile of automake deprecation warnings.
s/INCLUDES/AM_CPPFLAGS/g

I <3 sed :)
2013-11-24 13:11:50 +09:00
Bill Currie 6288684fa2 Fix more gcc 4.8 errors.
More actual bugs found, too.
2013-09-27 23:09:37 +09:00
Bill Currie 99a8e8f228 Fix the jump instruction.
The offset to compensate for st++ was missing.

Obviously, the code has never been tested.  Found while looking at the
jump code and thinking about using 32-bit addresses for the jump tables.
2013-06-26 09:59:19 +09:00
Bill Currie 88692f92d9 Fix the calls for Draw_Init in the gl renderers.
While namehack.h took care of the symbol mangling, I do prefer the calls to
be correct as it reduces confusion.
2013-05-09 17:58:33 +09:00
Bill Currie 0f75bdce17 Set the default joystick preamp to 0.01.
At the request of johnnyonflame. I probably should have done this when I
removed the builtin 1/100 scaling from the joystick code.
2013-04-19 13:54:30 +09:00
Bill Currie 247f3be0c0 Create reentrant versions of the set functions that need it.
Only the functions that allocate or delete sets or iterators.
2013-03-18 13:20:39 +09:00
Bill Currie 27bb337a60 Use set_bits_t for holding set elements.
set_bits_t is now 64 bits for x86_64 machines (in linux, anyway). This gave
qfvis a huge speed boost: from ~815s to ~720s.

Also, expose some of the set internals so custom set operators can be
created.
2013-03-16 21:26:49 +09:00
Bill Currie 7753583bfd Catch accuracy errors.
I'd forgotten to set the result flag. Unfortunately, the errors can get
very bad (1e-3) it seems :(
2013-03-13 17:16:34 +09:00
Bill Currie 6eec76dd49 Implement Fischer's SEB algorithm (for 3d).
Now we can get tight (<1e-6 * radius_squared error) bounding spheres. More
importantly (for qfvis, anyway) very quickly: 1.7Mspheres/second for a 5
point cloud on my 2.33GHz Core 2 :)
2013-03-13 17:10:55 +09:00
Bill Currie 9bbf1a9110 test the right cs function (oops) 2013-03-13 16:38:56 +09:00
Bill Currie 3193ffd9cc Better (-1..1) random numbers.
Now the distribution should be more even as the rng doesn't affect the
exponent.
2013-03-13 14:41:04 +09:00
Bill Currie b6d4766201 Add a function to find the circumsphere of up to 4 points.
It seems to be a little sloppy (an error of a bit less than 1e-4). This
might be why I'm having trouble with my SEB code.
2013-03-13 14:35:30 +09:00
Bill Currie 0cd6d93030 Add a function to get the barycentric coords of a point.
It "works" for lines, triangles and tetrahedrons. For lines and triangles,
it gives the barycentric coordinates of the perpendicular projection of the
point onto to features. Only tetrahedrons are guaranteed to reproduce the
original point.
2013-03-12 14:16:42 +09:00
Bill Currie ca0b03687f Change the naming of ALLOC's free-list.
Rather than prefixing free_ to the supplied name, suffix _freelist to the
supplied name. The biggest advantage of this is it allows the free-list to
be a structure member. It also cleans up the name-space a little.
2013-03-08 22:16:31 +09:00
Bill Currie eb2828e11c Add a function to pre-allocate space for a large set.
When the maximum set size is large but constant, and members will be added
one at a time, growing the set dynamically is not very efficient.
2013-03-07 10:27:30 +09:00
Bill Currie 7c1d9d2b84 Make the angle and light hacks optional.
I'd forgotten that ED_ConvertToPlist mangled light into light_lev and
single component angle values into a vector. This fixes much of the
breakage in qflight (but not the light levels)
2013-03-07 09:11:23 +09:00
Bill Currie 675db274a6 Use Sys_Error instead of PR_Error in ED_ConvertToPlist.
ED_ConvertToPlist is now independent of the progs engine as its only use
for the progs_t * param was for PR_Error.
2013-03-07 09:11:22 +09:00
Bill Currie 7d2e938d37 Correct some error messages.
ED_ParseEntity has been ED_ConvertToPlist for a long time now.
2013-03-07 09:11:22 +09:00
Bill Currie 8e86ce9de9 Implement Sys_LongTime and wrap it with Sys_DoubleTime.
Sys_LongTime returns time in microseconds as a 64-bit int. Sys_DoubleTime
uses Sys_LongTime, converts to double and offsets 0 time by 4G (2**32).
This gives us consistent sub-microsecond precision for a very long time.

See http://randomascii.wordpress.com/2012/02/13/dont-store-that-in-a-float/
2013-02-27 14:29:28 +09:00
Bill Currie 32b76b3576 Do not try to create directories that already exist.
It seem that solaris will return EACCESS instead of EEXIST if the user
doesn't have write permission in the parent directory.
2013-02-20 14:03:03 +09:00
Bill Currie a611ad57de Add Sys_isdir. 2013-02-20 13:59:31 +09:00
Bill Currie 6d7f747577 Add timerefresh to the glsl renderer.
Also, tweak the formatting of the output for the other renderers (%g
instead of %f) and make gl's timerefresh output unconditional.
2013-02-18 13:57:45 +09:00