Esempio n. 1
0
//
// PTR_SlideTraverse
//
static boolean PTR_SlideTraverse(intercept_t * in)
{
    line_t *li;

    if(!in->isaline)
        Con_Error("PTR_SlideTraverse: not a line?");

    li = in->d.line;

    if(!(li->flags & ML_TWOSIDED))
    {
        if(P_PointOnLineSide(slidemo->x, slidemo->y, li))
        {
            // don't hit the back side
            return true;
        }
        goto isblocking;
    }

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

    if(openrange < slidemo->height)
        goto isblocking;		// doesn't fit

    if(opentop - slidemo->z < slidemo->height)
        goto isblocking;		// mobj is too high

    if(openbottom - slidemo->z > 24 * FRACUNIT)
        goto isblocking;		// too big a step up

    // this line doesn't block movement
    return true;

    // the line does block movement,
    // see if it is closer than best so far
isblocking:
    if(in->frac < bestslidefrac)
    {
        secondslidefrac = bestslidefrac;
        secondslideline = bestslideline;
        bestslidefrac = in->frac;
        bestslideline = li;
    }
    return false;				// stop
}
Esempio n. 2
0
void
P_RecursiveSound
( sector_t*	sec,
  int		soundblocks )
{
    int		i;
    line_t*	check;
    sector_t*	other;
	
    // wake up all monsters in this sector
    if (sec->validcount == validcount
	&& sec->soundtraversed <= soundblocks+1)
    {
	return;		// already flooded
    }
    
    sec->validcount = validcount;
    sec->soundtraversed = soundblocks+1;
    sec->soundtarget = soundtarget;
	
    for (i=0 ;i<sec->linecount ; i++)
    {
	check = sec->lines[i];
	if (! (check->flags & ML_TWOSIDED) )
	    continue;
	
	P_LineOpening (check);

	if (openrange <= 0)
	    continue;	// closed door
	
	if ( sides[ check->sidenum[0] ].sector == sec)
	    other = sides[ check->sidenum[1] ] .sector;
	else
	    other = sides[ check->sidenum[0] ].sector;
	
	if (check->flags & ML_SOUNDBLOCK)
	{
	    if (!soundblocks)
		P_RecursiveSound (other, 1);
	}
	else
	    P_RecursiveSound (other, soundblocks);
    }
}
Esempio n. 3
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;
}
Esempio n. 4
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);
}
Esempio n. 5
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;
}