mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-27 16:01:17 +00:00
renderhitbox: shown MF_PAPERCOLLISION correctly
This commit is contained in:
parent
a51b889444
commit
600aec3449
2 changed files with 53 additions and 25 deletions
43
src/r_bbox.c
43
src/r_bbox.c
|
|
@ -204,29 +204,40 @@ void R_DrawThingBoundingBox(vissprite_t *vis)
|
|||
.color = R_GetBoundingBoxColor(vis->mobj),
|
||||
};
|
||||
|
||||
// 1--3
|
||||
// | |
|
||||
// 0--2
|
||||
if (vis->mobjflags & MF_PAPERCOLLISION)
|
||||
{
|
||||
// 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
|
||||
draw_bbox_col(&bb, 1, tx - rc, ty + rs); // top
|
||||
// left
|
||||
|
||||
// right
|
||||
draw_bbox_col(&bb, 0, tx, ty); // bottom
|
||||
draw_bbox_col(&bb, 1, tx - rc, ty + rs); // top
|
||||
|
||||
tx += rs;
|
||||
ty += rc;
|
||||
// right
|
||||
|
||||
draw_bbox_col(&bb, 2, tx, ty); // bottom
|
||||
draw_bbox_col(&bb, 3, tx - rc, ty + rs); // top
|
||||
tx += rs;
|
||||
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);
|
||||
draw_bbox_row(&bb, 1, 3);
|
||||
draw_bbox_row(&bb, 3, 2);
|
||||
draw_bbox_row(&bb, 2, 0);
|
||||
// connect all four columns
|
||||
|
||||
draw_bbox_row(&bb, 0, 1);
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -1586,13 +1586,22 @@ static void R_ProjectBoundingBox(mobj_t *thing, vissprite_t *vis)
|
|||
R_InterpolateMobjState(thing, FRACUNIT, &interp);
|
||||
}
|
||||
|
||||
// 1--3
|
||||
// | |
|
||||
// 0--2
|
||||
|
||||
// start in the (0) corner
|
||||
gx = interp.x - thing->radius - viewx;
|
||||
gy = interp.y - thing->radius - viewy;
|
||||
if (thing->flags & MF_PAPERCOLLISION)
|
||||
{
|
||||
// 0--1
|
||||
// start in the middle
|
||||
gx = interp.x - viewx;
|
||||
gy = interp.y - 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);
|
||||
|
||||
|
|
@ -1620,8 +1629,16 @@ static void R_ProjectBoundingBox(mobj_t *thing, vissprite_t *vis)
|
|||
box->gx = tx;
|
||||
box->gy = tz;
|
||||
|
||||
box->scale = 2 * FixedMul(thing->radius, viewsin);
|
||||
box->xscale = 2 * FixedMul(thing->radius, viewcos);
|
||||
if (thing->flags & MF_PAPERCOLLISION)
|
||||
{
|
||||
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->pzt = box->pz + box->thingheight;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue