diff --git a/src/m_bbox.cpp b/src/m_bbox.cpp index 199da8d68..c73f47bc4 100644 --- a/src/m_bbox.cpp +++ b/src/m_bbox.cpp @@ -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)y + radius, FIXED_MAX); + m_Box[BOXLEFT] = (fixed_t)MAX((SQWORD)x - radius, FIXED_MIN); + m_Box[BOXRIGHT] = (fixed_t)MIN((SQWORD)x + radius, FIXED_MAX); + m_Box[BOXBOTTOM] = (fixed_t)MAX((SQWORD)y - radius, FIXED_MIN); +} + + +//========================================================================== +// +// +// +//========================================================================== + void FBoundingBox::AddToBox (fixed_t x, fixed_t y) { if (x < m_Box[BOXLEFT]) diff --git a/src/m_bbox.h b/src/m_bbox.h index 256393d60..174cd6ecf 100644 --- a/src/m_bbox.h +++ b/src/m_bbox.h @@ -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 () {