- Major cleanup of Q16.16 utilisation within games and engine.

* Remove fix16.h/cpp and utilise library from m_fixed.h.
* Extend m_fixed.h with two inline functions for int to/from float operations.
* Replace fix16_floor operations with those from xs_Float.h
* Replace multiple Q16.16 conversions from 0 to just be 0.
* Replaced all found in-game bit-shifts and multiplications/divisions with inline functions from m_fixed.h
* Replaced many casts of FRACUNIT as double in SW's panel.cpp as it is converted to double by way of type promotion.
* Fixed missed precision fixes in SW's panel.cpp where some types weren't declared correctly.
* Replaced 100+ `Cos()/Sin() >> 16` operations for Blood with inline functions `CosScale16()/SinScale16()`.
This commit is contained in:
Mitchell Richters 2020-09-01 23:00:35 +10:00
parent d40e53eb53
commit 1354d52c05
104 changed files with 906 additions and 1579 deletions

View file

@ -481,7 +481,7 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int
int const initialsectnum = *sectnum;
int32_t const dawalclipmask = (cliptype & 65535); // CLIPMASK0 = 0x00010001
int32_t const dasprclipmask = (cliptype >> 16); // CLIPMASK1 = 0x01000040
int32_t const dasprclipmask = FixedToInt(cliptype); // CLIPMASK1 = 0x01000040
vec2_t const move = { xvect, yvect };
vec2_t goal = { pos->x + (xvect >> 14), pos->y + (yvect >> 14) };
@ -854,7 +854,7 @@ int pushmove(vec3_t *const vect, int16_t *const sectnum,
int bad;
const int32_t dawalclipmask = (cliptype&65535);
// const int32_t dasprclipmask = (cliptype>>16);
// const int32_t dasprclipmask = FixedToInt(cliptype);
if (*sectnum < 0)
return -1;
@ -1012,7 +1012,7 @@ void getzrange(const vec3_t *pos, int16_t sectnum,
const int32_t xmax = pos->x+extradist, ymax = pos->y+extradist;
const int32_t dawalclipmask = (cliptype&65535);
const int32_t dasprclipmask = (cliptype>>16);
const int32_t dasprclipmask = FixedToInt(cliptype);
vec2_t closest = pos->vec2;
if (enginecompatibility_mode == ENGINECOMPATIBILITY_NONE)
@ -1336,7 +1336,7 @@ int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32
// tmp: { (int32_t)curidx, (spritetype *)curspr, (!=0 if outer sector) }
intptr_t *tmpptr=NULL;
const int32_t dawalclipmask = (cliptype&65535);
const int32_t dasprclipmask = (cliptype>>16);
const int32_t dasprclipmask = FixedToInt(cliptype);
hit->sect = -1; hit->wall = -1; hit->sprite = -1;
if (sectnum < 0)