use boxonlineside for non player mobjs
This commit is contained in:
1 parent
47011c8e07
commit
3a0419703d
3 files changed
+63
-11
No files matched your search
+10
-2
@@ -1921,8 +1921,16 @@ static boolean PIT_CheckLine(line_t *ld)
|
||||
|| tmbbox[BOXTOP] <= ld->bbox[BOXBOTTOM] || tmbbox[BOXBOTTOM] >= ld->bbox[BOXTOP])
|
||||
return true;
|
||||
|
||||
if (P_CircleOnLineSide(tmx, tmy, tmthing->radius, ld) != -1)
|
||||
return true;
|
||||
if (tmthing->player)
|
||||
{
|
||||
if (P_CircleOnLineSide(tmx, tmy, tmthing->radius, ld) != -1)
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (P_BoxOnLineSide(tmbbox, ld) != -1)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tmthing->flags & MF_PAPERCOLLISION) // Caution! Turning whilst up against a wall will get you stuck. You probably shouldn't give the player this flag.
|
||||
{
|
||||
|
||||
+21
-5
@@ -559,9 +559,17 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t
|
||||
if (bbox[BOXRIGHT] <= ld->bbox[BOXLEFT] || bbox[BOXLEFT] >= ld->bbox[BOXRIGHT]
|
||||
|| bbox[BOXTOP] <= ld->bbox[BOXBOTTOM] || bbox[BOXBOTTOM] >= ld->bbox[BOXTOP])
|
||||
continue;
|
||||
|
||||
if (P_CircleOnLineSide(x, y, mobj->radius, ld) != -1)
|
||||
continue;
|
||||
|
||||
if (mobj->player)
|
||||
{
|
||||
if (P_CircleOnLineSide(x, y, mobj->radius, ld) != -1)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (P_BoxOnLineSide(bbox, ld) != -1)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lowest)
|
||||
finalheight = min(finalheight, HighestOnLine(mobj->radius, x, y, ld, slope, true));
|
||||
@@ -623,8 +631,16 @@ fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed
|
||||
|| bbox[BOXTOP] <= ld->bbox[BOXBOTTOM] || bbox[BOXBOTTOM] >= ld->bbox[BOXTOP])
|
||||
continue;
|
||||
|
||||
if (P_CircleOnLineSide(x, y, mobj->radius, ld) != -1)
|
||||
continue;
|
||||
if (mobj->player)
|
||||
{
|
||||
if (P_CircleOnLineSide(x, y, mobj->radius, ld) != -1)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (P_BoxOnLineSide(bbox, ld) != -1)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lowest)
|
||||
finalheight = min(finalheight, HighestOnLine(mobj->radius, x, y, ld, slope, true));
|
||||
|
||||
+32
-4
@@ -177,12 +177,26 @@ boolean P_PointInsidePolyobj(polyobj_t *po, fixed_t x, fixed_t y)
|
||||
//
|
||||
boolean P_MobjTouchingPolyobj(polyobj_t *po, mobj_t *mo)
|
||||
{
|
||||
fixed_t mbbox[4];
|
||||
size_t i;
|
||||
|
||||
mbbox[BOXTOP] = mo->y + mo->radius;
|
||||
mbbox[BOXBOTTOM] = mo->y - mo->radius;
|
||||
mbbox[BOXRIGHT] = mo->x + mo->radius;
|
||||
mbbox[BOXLEFT] = mo->x - mo->radius;
|
||||
|
||||
for (i = 0; i < po->numLines; i++)
|
||||
{
|
||||
if (P_CircleOnLineSide(mo->x, mo->y, mo->radius, po->lines[i]) == -1)
|
||||
return true;
|
||||
if (mo->player)
|
||||
{
|
||||
if (P_CircleOnLineSide(mo->x, mo->y, mo->radius, po->lines[i]) == -1)
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (P_BoxOnLineSide(mbbox, po->lines[i]) == -1)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -195,12 +209,26 @@ boolean P_MobjTouchingPolyobj(polyobj_t *po, mobj_t *mo)
|
||||
//
|
||||
boolean P_MobjInsidePolyobj(polyobj_t *po, mobj_t *mo)
|
||||
{
|
||||
fixed_t mbbox[4];
|
||||
size_t i;
|
||||
|
||||
mbbox[BOXTOP] = mo->y + mo->radius;
|
||||
mbbox[BOXBOTTOM] = mo->y - mo->radius;
|
||||
mbbox[BOXRIGHT] = mo->x + mo->radius;
|
||||
mbbox[BOXLEFT] = mo->x - mo->radius;
|
||||
|
||||
for (i = 0; i < po->numLines; i++)
|
||||
{
|
||||
if (P_CircleOnLineSide(mo->x, mo->y, mo->radius, po->lines[i]) == 0)
|
||||
return false;
|
||||
if (mo->player)
|
||||
{
|
||||
if (P_CircleOnLineSide(mo->x, mo->y, mo->radius, po->lines[i]) == 0)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (P_BoxOnLineSide(mbbox, po->lines[i]) == 0)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user