- fixed: The FBoundingBox constructor taking a point and a radius needs to restrict the resulting values to the fixed point range.

This commit is contained in:
Christoph Oelckers 2015-03-14 09:34:55 +01:00
parent 9a09fbd7ed
commit da26e10951
2 changed files with 22 additions and 7 deletions

View file

@ -27,6 +27,27 @@
#include "m_bbox.h"
#include "p_local.h"
//==========================================================================
//
//
//
//==========================================================================
FBoundingBox::FBoundingBox(fixed_t x, fixed_t y, fixed_t radius)
{
m_Box[BOXTOP] = (fixed_t)MIN<SQWORD>((SQWORD)y + radius, FIXED_MAX);
m_Box[BOXLEFT] = (fixed_t)MAX<SQWORD>((SQWORD)x - radius, FIXED_MIN);
m_Box[BOXRIGHT] = (fixed_t)MIN<SQWORD>((SQWORD)x + radius, FIXED_MAX);
m_Box[BOXBOTTOM] = (fixed_t)MAX<SQWORD>((SQWORD)y - radius, FIXED_MIN);
}
//==========================================================================
//
//
//
//==========================================================================
void FBoundingBox::AddToBox (fixed_t x, fixed_t y)
{
if (x < m_Box[BOXLEFT])

View file

@ -43,13 +43,7 @@ public:
m_Box[BOXBOTTOM] = bottom;
}
FBoundingBox(fixed_t x, fixed_t y, fixed_t radius)
{
m_Box[BOXTOP] = y + radius;
m_Box[BOXLEFT] = x - radius;
m_Box[BOXRIGHT] = x + radius;
m_Box[BOXBOTTOM] = y - radius;
}
FBoundingBox(fixed_t x, fixed_t y, fixed_t radius);
void ClearBox ()
{