Esempio n. 1
0
        /*
         * ==================== SV_AreaEdicts_r
         *
         * ====================
         */
        public static void SV_AreaEdicts_r(areanode_t node)
        {
            link_t  l, next, start;
            edict_t check;

            // touch linked edicts
            if (SV_WORLD.area_type == Defines.AREA_SOLID)
            {
                start = node.solid_edicts;
            }
            else
            {
                start = node.trigger_edicts;
            }

            for (l = start.next; l != start; l = next)
            {
                next  = l.next;
                check = (edict_t)l.o;

                if (check.solid == Defines.SOLID_NOT)
                {
                    continue;                     // deactivated
                }
                if (check.absmin[0] > SV_WORLD.area_maxs[0] ||
                    check.absmin[1] > SV_WORLD.area_maxs[1] ||
                    check.absmin[2] > SV_WORLD.area_maxs[2] ||
                    check.absmax[0] < SV_WORLD.area_mins[0] ||
                    check.absmax[1] < SV_WORLD.area_mins[1] ||
                    check.absmax[2] < SV_WORLD.area_mins[2])
                {
                    continue;                     // not touching
                }
                if (SV_WORLD.area_count == SV_WORLD.area_maxcount)
                {
                    Com.Printf("SV_AreaEdicts: MAXCOUNT\n");

                    return;
                }

                SV_WORLD.area_list[SV_WORLD.area_count] = check;
                SV_WORLD.area_count++;
            }

            if (node.axis == -1)
            {
                return;                 // terminal node
            }
            // recurse down both sides
            if (SV_WORLD.area_maxs[node.axis] > node.dist)
            {
                SV_WORLD.SV_AreaEdicts_r(node.children[0]);
            }

            if (SV_WORLD.area_mins[node.axis] < node.dist)
            {
                SV_WORLD.SV_AreaEdicts_r(node.children[1]);
            }
        }
Esempio n. 2
0
        /*
         * ================ SV_AreaEdicts ================
         */
        public static int SV_AreaEdicts(float[] mins, float[] maxs, edict_t[] list, int maxcount, int areatype)
        {
            SV_WORLD.area_mins     = mins;
            SV_WORLD.area_maxs     = maxs;
            SV_WORLD.area_list     = list;
            SV_WORLD.area_count    = 0;
            SV_WORLD.area_maxcount = maxcount;
            SV_WORLD.area_type     = areatype;
            SV_WORLD.SV_AreaEdicts_r(SV_WORLD.sv_areanodes[0]);

            return(SV_WORLD.area_count);
        }