Esempio n. 1
0
static int RTreeSearchNode (node_t n, rect_t s, SearchHitCallback f, void *arg)
{
  int i;
  int c = 0;

  if (n->level > 0)
    {
      for (i = 0; i < MAXCARD; i++)
        if (n->branch[i].child &&
            RectOverlap (s,n->branch[i].mbr))
          c += RTreeSearchNode ((node_t) n->branch[i].child, s, f, arg);
    }
  else
    {
      for (i = 0; i < MAXCARD; i++)
        if (n->branch[i].child &&
            RectOverlap (s,n->branch[i].mbr))
          {
            c ++;
            if (f)
              if ( !f(&(n->branch[i].mbr),n->branch[i].child,arg))
                return c;
          }
    }
  return c;
}
Esempio n. 2
0
VOID DrawBorderShade(PLAYERp pp, short shade_num, short wx1, short wy1, short wx2, short wy2)
    {
    short i,j,k,l;
    PANEL_SPRITEp psp;
    int dark_shade = 27 - (shade_num * 6);
    int light_shade = 20 - (shade_num * 6);
    
    for (i = 0; i < xdim; i += tilesizx[BORDER_TILE])
        {
        for (j = 0; j < ydim; j += tilesizy[BORDER_TILE])
            {
            k = i + tilesizx[BORDER_TILE];
            l = j + tilesizy[BORDER_TILE];
            
            if (RectOverlap(i, j, k, l, wx1 - 1, wy1 - 1, wx2 + 1, wy1))
                {
                // draw top box of the border
                psp = pSpawnFullScreenSpriteBox(pp, ID_BORDER_TOP, BORDER_TILE, PRI_BACK + 1, i, j, wx1 - 1, wy1 - 1, wx2 + 1, wy1);
                psp->shade = dark_shade;
                psp->ID = ID_BORDER_SHADE;
                }
                
            if (RectOverlap(i, j, k, l, wx1 - 1, wy2, wx2 + 1, wy2 + 1))
                {
                // draw bottom box of the border
                psp = pSpawnFullScreenSpriteBox(pp, ID_BORDER_BOTTOM, BORDER_TILE, PRI_BACK + 1, i, j, wx1 - 1, wy2, wx2 + 1, wy2 + 1);
                psp->shade = light_shade;
                psp->ID = ID_BORDER_SHADE;
                }
            if (RectOverlap(i, j, k, l, wx1 - 1, wy1 - 1, wx1, wy2 + 1))
                {
                // draw left box of the border
                psp = pSpawnFullScreenSpriteBox(pp, ID_BORDER_LEFT, BORDER_TILE, PRI_BACK + 1, i, j, wx1 - 1, wy1 - 1, wx1, wy2 + 1);
                psp->shade = dark_shade;
                psp->ID = ID_BORDER_SHADE;
                }
            if (RectOverlap(i, j, k, l, wx2, wy1 - 1, wx2 + 1, wy2 + 1))
                {
                // draw right box of the border
                psp = pSpawnFullScreenSpriteBox(pp, ID_BORDER_RIGHT, BORDER_TILE, PRI_BACK + 1, i, j, wx2, wy1 - 1, wx2 + 1, wy2 + 1);
                psp->shade = light_shade;
                psp->ID = ID_BORDER_SHADE;
                }
            }
        }
    }