The routine vm_vec_normalize_quick_mag() did not normalize a vector.
Instead of dividing the vector by the 'quick magnitude', it multiplied
it. This routine was only called by one other routine (which was
fortunately unused)--vm_vec_normalized_dir_quick_mag().
Given both the incorrect behavior as well as their lack of use, those
routines have been removed.
Signed-off-by: Peter Mitsis <[email protected]>
Uses fl_abs() (which evaluates to fabsf()) instead of an if-else
statement to get the absolute value of a float. A compiler for the
x86 platform is able use SSE instructions to optimize calls to fabsf().
Signed-off-by: Peter Mitsis <[email protected]>
Replaces calls to double-precision floating point trig functions with
calls to single-precision floating point trig functions as follows:
cos() -> cosf()
sin() -> sinf()
tan() -> tanf()
acos() -> acosf()
asin() -> asinf()
atan() -> atanf()
This allows the compiler to avoid generating unnecessary instructions
that convert a float to a double and then a double back to a float.
Signed-off-by: Peter Mitsis <[email protected]>
Instead of performing three consecutive divisions, vm_vec_avg_n() now performs
one division at the start and three multiplications at the end. Recall that
multiplication is faster than division.
Signed-off-by: Peter Mitsis <[email protected]>
The routine atan2_safe() already contains a test that checks if both parameters
are zero--that is the point of the routine. Thus, there is no need for the
caller of atan2_safe() to perform that same check.
Signed-off-by: Peter Mitsis <[email protected]>
The routine vm_vec_normalize() always returns a value greater than zero.
Thus, there is no need to test its return value for values that are less
than or equal to zero.
Signed-off-by: Peter Mitsis <[email protected]>
The routine vm_vec_copy_normalize() always returns a value greater than zero.
Thus, there is no need to test its return value for values that are less than
or equal to zero.
Signed-off-by: Peter Mitsis <[email protected]>
Not only is the routine vm_fvec_matrix_interpolate() unused, it does not appear
to have been used for the duration of the project. The only reference to it
found in the history was in a removed comment. That comment indicated that it
was implemented in 1997.
Signed-off-by: Peter Mitsis <[email protected]>
Instead of perform three consecutive divisions, vm_vec_avg_n() now performs one
division at the start and three multiplications at the end. Recall that
multiplication is faster than division.
Signed-off-by: Peter Mitsis <[email protected]>
The routine atan2_safe() already contains a test that checks if both parameters
are zero--that is the point of the routine. Thus, there is no need for the
caller of atan2_safe() to perform that same check.
Signed-off-by: Peter Mitsis <[email protected]>
Changes the file mode bits of vecmat.h and vecmat.cpp to make them consistent
with the other files under "code/math".
Signed-off-by: Peter Mitsis <[email protected]>
Overhaul hudartillery.cpp to use STL containers (removes hardcoded limits on maximum number of strike types, simultaneously active strikes, and projectiles per strike), use modular tables, allow for different shape options, and allow beams as the weapon.