Commit graph

127 commits

Author SHA1 Message Date
Kp d8ab3c9bd3 Remove quadint members low, high
Always access the data through the member `q`.  This makes the code
independent of architecture endian decisions.
2022-05-24 02:32:58 +00:00
Kp 62635ec285 Use enum class for vm_magnitude_squared 2022-05-24 02:32:58 +00:00
Kp b8a8a61ff8 Simplify multiplayer powerup creation
Instead of creating the powerup from a player, then overwriting the
location and velocity of the powerup, and fixing up its segment, create
the powerup directly where it should be, with the intended velocity.
2022-01-09 15:25:42 +00:00
Kp ba01b2bdc1 Convert some math functions to fixang
The value was always truncated internally anyway.  Move the truncation
to the call boundary, since most callers started with a fixang.
2021-11-01 03:37:20 +00:00
Kp e1aac6949a Replace __attribute_warn_unused_result with C++17 [[nodiscard]]
This eliminates a configure test, and may help readers understand the
annotation more readily.
2021-06-28 03:37:51 +00:00
Kp 53761500f1 Qualify uses of std::array 2020-05-02 21:18:42 +00:00
Kp e61100a858 Fix integer truncation in quaternion setup
Commit 47a6f744d split out redundant code, but accidentally stored
temporaries in a `signed short` instead of a `fix` as they should have
been.  This truncated some values, causing odd results whenever
quaternions were used.  Fix the problem by storing the intermediate
results in a `fix`.

Fixes: 47a6f744d8 ("Factor out vms_quaternion_from_matrix division")
Reported-by: Ninjared <https://forum.dxx-rebirth.com/showthread.php?tid=1113>
2019-04-13 18:00:07 +00:00
Kp 47a6f744d8 Factor out vms_quaternion_from_matrix division 2019-02-02 18:36:39 +00:00
Kp 12b57e84e6 Switch most in-tree http:// links to https://
For each link given as http://, verify that the site is accessible over
https:// and, if so, switch to it.  These domains were converted:

* llvm.org
* clang.llvm.org
* en.cppreference.com
* www.dxx-rebirth.com
* www.libsdl.org
* www.scons.org
2018-09-02 00:57:29 +00:00
Kp 813d73eedd Pass vms_matrix &to vms_matrix_from_quaternion 2018-03-31 21:53:01 +00:00
Kp 45f59c384b Pass vms_matrix &to vms_quaternion_from_matrix 2018-03-31 21:53:01 +00:00
Kp 6a3ded191f Move EDITOR to dxxsconf.h; rename to DXX_USE_EDITOR
Rename symbol EDITOR to DXX_USE_EDITOR to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -wl EDITOR -- '*.h' '*.cpp' | xargs sed -i -e 's/^\s*#ifdef \(EDITOR\)\>/#if DXX_USE_\1/' -e 's/\s*#\(el\)\?if \(.*\)defined(\(EDITOR\))/#\1if \2DXX_USE_\3/' -e 's/^\s*#ifndef \(EDITOR\)\>/#if !DXX_USE_\1/'
2016-09-11 18:49:16 +00:00
Kp 99bbd0cf26 Mark global constants as constexpr
s/^const \([^*]*=.*;\)/constexpr \1/
2016-07-23 04:10:42 +00:00
Kp b282bea173 Rewrite simple integer casts from C style to static_cast<>
This pass only targets commonly used standard types.

s/(\(\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\)\s*)\s*(/static_cast<\1>(/g
2016-06-05 01:04:26 +00:00
Kp 7fdce88558 Add parentheses around target of simple casts
C casts do not require parentheses.  C++ casts require grouping around
the target.  Prepare for conversion to C++ casts by adding otherwise
unnecessary parentheses around the target of simple C casts.

This pass does not attempt to process expressions that involve
any subexpression that can nest arbitrarily, such as parentheses or
brackets.  It also works only on commonly used standard types.

	(int) a->b;	// changed
	(int) a[b];	// not changed

s/\((\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\s*\**\s*)\s*\)\([&+-]\?\)\([[:alnum:]_.]\+\s*->\s*\)*\([[:alnum:]_.]\+\)\(\s*\([];+>)*\/^%,|&<>]\)\|$\|\(\s*-\s*[^>]\)\)/\1(\5\6\7)\8/g
2016-06-05 01:04:25 +00:00
Kp 568f165c28 Shrink sincos_table
For all valid i, sincos_table[i] == sincos_table[i % 256].  Remove
elements [256:] and modify callers to truncate the index.
2016-01-09 16:38:11 +00:00
Kp dc8c0323d8 Uninline namespace dcx 2015-12-13 18:00:49 +00:00
Kp cfc35e819d Use inline namespace dcx for common/maths 2015-12-05 22:57:24 +00:00
Kp 4f871c43fe Add compile-time check for non-overlapping vm_matrix_x_matrix 2015-08-13 03:15:52 +00:00
Kp c9dff229f1 Remove dead AI fire leading code 2015-07-25 23:10:47 +00:00
Kp a918692a23 Preprocess out EDITOR-only vm_vec_ang_2_matrix
Remove vm_vec_ang_2_matrix from non-EDITOR builds so that
sincos_2_matrix has only one caller, allowing compiler to implicitly
inline it.
2015-06-02 03:03:32 +00:00
Kp 0f6a82963a Inline fix_sincos in vm_extract_angles_matrix 2015-06-02 03:03:32 +00:00
Kp b207aa6900 Shorten vm_angles_2_matrix 2015-06-02 03:03:31 +00:00
Bradley Bell bdacd2f7d7 change u_int*_t to C99 standard uint*_t 2015-05-18 17:12:53 -07:00
Kp 9f01dcf0db Use signed multiplier in fix_sincos
Fixes: a5b83d19de ("Simplify fix_sin/fix_cos calls")
2015-04-30 03:32:27 +00:00
Kp a5b83d19de Simplify fix_sin/fix_cos calls 2015-04-29 03:35:09 +00:00
Kp 5e4bd5c73f vm_vec_delta_ang: check for vm_vec_copy_normalize failure
derhass reports that Raspbian g++-4.8.2 rejects vecmat.cpp for
-Wmaybe-uninitialized on t0, t1.  Fix it by adding code to return 0 if
vm_vec_copy_normalize leaves the temporary uninitialized.

Reported-by: derhass <https://github.com/dxx-rebirth/dxx-rebirth/issues/55>
2015-04-03 02:46:25 +00:00
Kp 90fbebf8fd Convert most global arrays to array<> 2015-04-02 02:36:52 +00:00
Kp 2c09f9fa90 Propagate special types for distance/magnitude 2015-03-12 02:21:19 +00:00
Kp f7d0c853ba Use special types for distance/magnitude 2015-03-12 02:21:19 +00:00
Kp ddfa4aeecf Inline away fixmulaccum in vm_vec_mag2 2015-02-05 03:03:51 +00:00
Kp 536c9af35d Pass sincos_2_matrix arg by & 2015-02-05 03:03:51 +00:00
Kp 673a711461 Remove vm_angles_2_matrix return value 2015-02-05 03:03:51 +00:00
Kp 1c58627aa3 Remove unused cos from fix_fastsincos 2015-02-05 03:03:50 +00:00
Kp 4c8f3a47b5 Convert frequently used casts to C++ casts 2015-02-05 03:03:49 +00:00
Kp 0b18b4140e Switch vm_vec_scale2 back to ALU
fixmuldiv uses higher precision now
2015-02-05 03:03:48 +00:00
Kp a8784bc486 Fold fixmul calls to fixmul64 2015-02-05 03:03:48 +00:00
Kp 949b019d55 Delegate vm_vec_scale to vm_vec_copy_scale 2015-02-03 00:37:08 +00:00
Kp d1f5695562 Remove unused return value of vm_vec_scale_add 2015-02-03 00:37:08 +00:00
Kp 2026ab7e3a Remove unused return value of vm_extract_angles_vector 2015-02-03 00:37:08 +00:00
Kp 656c51fa99 Remove unused return value of vm_vec_rotate 2015-02-03 00:37:08 +00:00
Kp 505a3dbae7 Remove unused return value of vm_vector_2_matrix 2015-02-03 00:37:07 +00:00
Kp c6f95c5880 Remove unused return value of vm_vec_normal 2015-02-03 00:37:07 +00:00
Kp 52267b87b9 Remove unused return value of vm_vec_cross 2015-02-03 00:37:07 +00:00
Kp aa75eb212c Remove unused return value of vm_vec_perp 2015-02-03 00:37:07 +00:00
Kp 055f9593de Remove unused return value of vm_vec_scale2 2015-02-03 00:37:07 +00:00
Kp cca8fd65a1 Remove unused return value of vm_vec_scale_add2 2015-02-03 00:37:07 +00:00
Kp e0bf0be779 Remove unused return value of vm_vec_add2 2015-02-03 00:37:07 +00:00
Kp e14440b0e0 Remove unused return value of vm_vec_sub2 2015-02-03 00:37:07 +00:00
Kp cd7e99981b Remove unused return value of vm_vec_avg 2015-02-03 00:37:07 +00:00