doom

a minimalistic implementation of doom
git clone git://ssnf.xyz/doom
Log | Files | Refs

m_bbox.c (380B)


      1 #include "m_bbox.h"
      2 
      3 void
      4 M_ClearBox(fixed_t* box)
      5 {
      6 	box[BOXTOP] = box[BOXRIGHT] = INT_MIN;
      7 	box[BOXBOTTOM] = box[BOXLEFT] = INT_MAX;
      8 }
      9 
     10 void
     11 M_AddToBox(fixed_t* box, fixed_t x, fixed_t y)
     12 {
     13 	if (x < box[BOXLEFT])
     14 		box[BOXLEFT] = x;
     15 	else if (x > box[BOXRIGHT])
     16 		box[BOXRIGHT] = x;
     17 	if (y < box[BOXBOTTOM])
     18 		box[BOXBOTTOM] = y;
     19 	else if (y > box[BOXTOP])
     20 		box[BOXTOP] = y;
     21 }