renderhitbox: shown MF_PAPERCOLLISION correctly

This commit is contained in:
James R 2023-11-15 14:48:53 -08:00
parent a51b889444
commit 600aec3449
2 changed files with 53 additions and 25 deletions

View file

@ -204,29 +204,40 @@ void R_DrawThingBoundingBox(vissprite_t *vis)
.color = R_GetBoundingBoxColor(vis->mobj), .color = R_GetBoundingBoxColor(vis->mobj),
}; };
// 1--3 if (vis->mobjflags & MF_PAPERCOLLISION)
// | | {
// 0--2 // 0--1
// left draw_bbox_col(&bb, 0, tx - rc, ty - rs); // left
draw_bbox_col(&bb, 1, tx + rc, ty + rs); // right
draw_bbox_row(&bb, 0, 1); // connect both
}
else
{
// 1--3
// | |
// 0--2
draw_bbox_col(&bb, 0, tx, ty); // bottom // left
draw_bbox_col(&bb, 1, tx - rc, ty + rs); // top
// right draw_bbox_col(&bb, 0, tx, ty); // bottom
draw_bbox_col(&bb, 1, tx - rc, ty + rs); // top
tx += rs; // right
ty += rc;
draw_bbox_col(&bb, 2, tx, ty); // bottom tx += rs;
draw_bbox_col(&bb, 3, tx - rc, ty + rs); // top ty += rc;
// connect all four columns draw_bbox_col(&bb, 2, tx, ty); // bottom
draw_bbox_col(&bb, 3, tx - rc, ty + rs); // top
draw_bbox_row(&bb, 0, 1); // connect all four columns
draw_bbox_row(&bb, 1, 3);
draw_bbox_row(&bb, 3, 2); draw_bbox_row(&bb, 0, 1);
draw_bbox_row(&bb, 2, 0); draw_bbox_row(&bb, 1, 3);
draw_bbox_row(&bb, 3, 2);
draw_bbox_row(&bb, 2, 0);
}
} }
static boolean is_tangible (mobj_t *thing) static boolean is_tangible (mobj_t *thing)

View file

@ -1586,13 +1586,22 @@ static void R_ProjectBoundingBox(mobj_t *thing, vissprite_t *vis)
R_InterpolateMobjState(thing, FRACUNIT, &interp); R_InterpolateMobjState(thing, FRACUNIT, &interp);
} }
// 1--3 if (thing->flags & MF_PAPERCOLLISION)
// | | {
// 0--2 // 0--1
// start in the middle
// start in the (0) corner gx = interp.x - viewx;
gx = interp.x - thing->radius - viewx; gy = interp.y - viewy;
gy = interp.y - thing->radius - viewy; }
else
{
// 1--3
// | |
// 0--2
// start in the (0) corner
gx = interp.x - thing->radius - viewx;
gy = interp.y - thing->radius - viewy;
}
tz = FixedMul(gx, viewcos) + FixedMul(gy, viewsin); tz = FixedMul(gx, viewcos) + FixedMul(gy, viewsin);
@ -1620,8 +1629,16 @@ static void R_ProjectBoundingBox(mobj_t *thing, vissprite_t *vis)
box->gx = tx; box->gx = tx;
box->gy = tz; box->gy = tz;
box->scale = 2 * FixedMul(thing->radius, viewsin); if (thing->flags & MF_PAPERCOLLISION)
box->xscale = 2 * FixedMul(thing->radius, viewcos); {
box->scale = FixedMul(thing->radius, FCOS(viewangle - interp.angle));
box->xscale = FixedMul(thing->radius, FSIN(viewangle - interp.angle));
}
else
{
box->scale = 2 * FixedMul(thing->radius, viewsin);
box->xscale = 2 * FixedMul(thing->radius, viewcos);
}
box->pz = interp.z; box->pz = interp.z;
box->pzt = box->pz + box->thingheight; box->pzt = box->pz + box->thingheight;