Ejemplo n.º 1
0
//===========================================================================
// PIT_CheckLine
//  Adjusts tmfloorz and tmceilingz as lines are contacted.
//===========================================================================
static boolean PIT_CheckLine(line_t *ld, void *parm)
{
    checkpos_data_t *tm = parm;
    fixed_t bbox[4];

    // Setup the bounding box for the line.
    ORDER(ld->v1->x, ld->v2->x, bbox[BOXLEFT], bbox[BOXRIGHT]);
    ORDER(ld->v1->y, ld->v2->y, bbox[BOXBOTTOM], bbox[BOXTOP]);

    if(tm->box[BOXRIGHT] <= bbox[BOXLEFT] || tm->box[BOXLEFT] >= bbox[BOXRIGHT]
            || tm->box[BOXTOP] <= bbox[BOXBOTTOM] ||
            tm->box[BOXBOTTOM] >= bbox[BOXTOP])
        return true;

    if(P_BoxOnLineSide(tm->box, ld) != -1)
        return true;

    // A line has been hit.
    tm->thing->wallhit = true;

    if(!ld->backsector)
        return false;			// One sided line, can't go through.

    if(!(tm->thing->ddflags & DDMF_MISSILE))
    {
        if(ld->flags & ML_BLOCKING)
            return false;		// explicitly blocking everything
    }

    // set openrange, opentop, openbottom.
    P_LineOpening(ld);

    // adjust floor / ceiling heights.
    if(opentop < tm->ceilingz)
        tm->ceilingz = opentop;
    if(openbottom > tm->floorz)
        tm->floorz = openbottom;
    if(lowfloor < tm->dropoffz)
        tm->dropoffz = lowfloor;

    tm->thing->wallhit = false;
    return true;
}
Ejemplo n.º 2
0
boolean PIT_CheckLine(line_t * ld)
{
    if (tmbbox[BOXRIGHT] <= ld->bbox[BOXLEFT]
        || tmbbox[BOXLEFT] >= ld->bbox[BOXRIGHT]
        || tmbbox[BOXTOP] <= ld->bbox[BOXBOTTOM]
        || tmbbox[BOXBOTTOM] >= ld->bbox[BOXTOP])
    {
        return (true);
    }
    if (P_BoxOnLineSide(tmbbox, ld) != -1)
    {
        return (true);
    }

// a line has been hit
/*
=
= The moving thing's destination position will cross the given line.
= If this should not be allowed, return false.
= If the line is special, keep track of it to process later if the move
= 	is proven ok.  NOTE: specials are NOT sorted by order, so two special lines
= 	that are only 8 pixels apart could be crossed in either order.
*/

    if (!ld->backsector)
    {                           // One sided line
        if (tmthing->flags & MF_MISSILE)
        {                       // Missiles can trigger impact specials
            if (ld->special)
            {
                spechit[numspechit] = ld;
                numspechit++;
            }
        }
        return false;
    }
    if (!(tmthing->flags & MF_MISSILE))
    {
        if (ld->flags & ML_BLOCKING)
        {                       // Explicitly blocking everything
            return (false);
        }
        if (!tmthing->player && ld->flags & ML_BLOCKMONSTERS
            && tmthing->type != MT_POD)
        {                       // Block monsters only
            return (false);
        }
    }
    P_LineOpening(ld);          // set openrange, opentop, openbottom
    // adjust floor / ceiling heights
    if (opentop < tmceilingz)
    {
        tmceilingz = opentop;
        ceilingline = ld;
    }
    if (openbottom > tmfloorz)
    {
        tmfloorz = openbottom;
    }
    if (lowfloor < tmdropoffz)
    {
        tmdropoffz = lowfloor;
    }
    if (ld->special)
    {                           // Contacted a special line, add it to the list
        spechit[numspechit] = ld;
        numspechit++;
    }
    return (true);
}
Ejemplo n.º 3
0
//
// PIT_CheckLine
// Adjusts tmfloorz and tmceilingz as lines are contacted
//
boolean PIT_CheckLine (line_t* ld)
{
    if (tmbbox[BOXRIGHT] <= ld->bbox[BOXLEFT]
	|| tmbbox[BOXLEFT] >= ld->bbox[BOXRIGHT]
	|| tmbbox[BOXTOP] <= ld->bbox[BOXBOTTOM]
	|| tmbbox[BOXBOTTOM] >= ld->bbox[BOXTOP] )
	return true;

    if (P_BoxOnLineSide (tmbbox, ld) != -1)
	return true;

    // A line has been hit

    // The moving thing's destination position will cross
    // the given line.
    // If this should not be allowed, return false.
    // If the line is special, keep track of it
    // to process later if the move is proven ok.
    // NOTE: specials are NOT sorted by order,
    // so two special lines that are only 8 pixels apart
    // could be crossed in either order.

    if (!ld->backsector)
    {
	blockline = ld;
	return false;		// one sided line
    }

    if (!(tmthing->flags & MF_MISSILE) )
    {
	if ( ld->flags & ML_BLOCKING )
	    return false;	// explicitly blocking everything

	// killough 8/9/98: monster-blockers don't affect friends
	if (!(tmthing->flags & MF_FRIEND || tmthing->player)
	  && ld->flags & ML_BLOCKMONSTERS)
	    return false;	// block monsters only
    }

    // set openrange, opentop, openbottom
    P_LineOpening (ld);

    // adjust floor / ceiling heights
    if (opentop < tmceilingz)
    {
	tmceilingz = opentop;
	ceilingline = ld;
	blockline = ld;
    }

    if (openbottom > tmfloorz)
    {
	tmfloorz = openbottom;
	blockline = ld;
    }

    if (lowfloor < tmdropoffz)
	tmdropoffz = lowfloor;

    // if contacted a special line, add it to the list
    if (ld->special)
    {
	// 1/11/98 killough: remove limit on lines hit
	if (numspechit >= spechit_max)
	{
	    spechit_max += 32;
	    spechit = (line_t **)realloc(spechit, sizeof(*spechit) * spechit_max);
	    if (spechit == NULL)
	      I_Error ("PIT_CheckLine: No RAM");
	}
	spechit[numspechit++] = ld;
    }

    return true;
}