Commit graph

3807 commits

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