mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-24 20:52:13 +00:00
Merge branch 'bbox-tweaks' into 'bbox'
Add interpolation to hitbox viewer, tweak hitbox colors See merge request STJr/SRB2!1927
This commit is contained in:
commit
8c08eb1676
5 changed files with 48 additions and 10 deletions
|
@ -873,6 +873,7 @@ void D_RegisterClientCommands(void)
|
|||
// screen.c
|
||||
CV_RegisterVar(&cv_fullscreen);
|
||||
CV_RegisterVar(&cv_renderview);
|
||||
CV_RegisterVar(&cv_renderhitboxinterpolation);
|
||||
CV_RegisterVar(&cv_renderhitbox);
|
||||
CV_RegisterVar(&cv_renderer);
|
||||
CV_RegisterVar(&cv_scr_depth);
|
||||
|
|
|
@ -5686,9 +5686,22 @@ static void HWR_ProjectBoundingBox(mobj_t *thing)
|
|||
if (!R_ThingBoundingBoxVisible(thing))
|
||||
return;
|
||||
|
||||
// uncapped/interpolation
|
||||
boolean interpolate = cv_renderhitboxinterpolation.value;
|
||||
interpmobjstate_t interp = {0};
|
||||
|
||||
if (R_UsingFrameInterpolation() && !paused && interpolate)
|
||||
{
|
||||
R_InterpolateMobjState(thing, rendertimefrac, &interp);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_InterpolateMobjState(thing, FRACUNIT, &interp);
|
||||
}
|
||||
|
||||
// transform the origin point
|
||||
tr_x = FIXED_TO_FLOAT(thing->x) - gl_viewx;
|
||||
tr_y = FIXED_TO_FLOAT(thing->y) - gl_viewy;
|
||||
tr_x = FIXED_TO_FLOAT(interp.x) - gl_viewx;
|
||||
tr_y = FIXED_TO_FLOAT(interp.y) - gl_viewy;
|
||||
|
||||
// rotation around vertical axis
|
||||
tz = (tr_x * gl_viewcos) + (tr_y * gl_viewsin);
|
||||
|
@ -5707,7 +5720,7 @@ static void HWR_ProjectBoundingBox(mobj_t *thing)
|
|||
vis->x2 = tr_x + rad;
|
||||
vis->z1 = tr_y - rad;
|
||||
vis->z2 = tr_y + rad;
|
||||
vis->gz = FIXED_TO_FLOAT(thing->z);
|
||||
vis->gz = FIXED_TO_FLOAT(interp.z);
|
||||
vis->gzt = vis->gz + FIXED_TO_FLOAT(thing->height);
|
||||
vis->mobj = thing;
|
||||
|
||||
|
|
14
src/r_bbox.c
14
src/r_bbox.c
|
@ -35,6 +35,7 @@ static CV_PossibleValue_t renderhitbox_cons_t[] = {
|
|||
{0}};
|
||||
|
||||
consvar_t cv_renderhitbox = CVAR_INIT ("renderhitbox", "Off", 0, renderhitbox_cons_t, NULL);
|
||||
consvar_t cv_renderhitboxinterpolation = CVAR_INIT ("renderhitbox_interpolation", "On", CV_SAVE, CV_OnOff, NULL);
|
||||
|
||||
struct bbox_col {
|
||||
INT32 x;
|
||||
|
@ -179,12 +180,21 @@ UINT8 R_GetBoundingBoxColor(mobj_t *thing)
|
|||
if (flags & (MF_NOCLIPTHING))
|
||||
return 7; // BFBFBF
|
||||
|
||||
if (flags & (MF_BOSS|MF_MISSILE|MF_ENEMY|MF_PAIN))
|
||||
if (flags & (MF_BOSS|MF_ENEMY))
|
||||
return 35; // F00
|
||||
|
||||
if (flags & (MF_MISSILE|MF_PAIN))
|
||||
return 54; // F70
|
||||
|
||||
if (flags & (MF_SPECIAL|MF_MONITOR))
|
||||
return 73; // FF0
|
||||
|
||||
if (flags & MF_PUSHABLE)
|
||||
return 112; // 0F0
|
||||
|
||||
if (flags & (MF_SPRING))
|
||||
return 181; // F0F
|
||||
|
||||
if (flags & (MF_NOCLIP))
|
||||
return 152; // 00F
|
||||
|
||||
|
@ -299,7 +309,7 @@ boolean R_ThingBoundingBoxVisible(mobj_t *thing)
|
|||
return is_tangible(thing);
|
||||
|
||||
case RENDERHITBOX_RINGS:
|
||||
return (thing->type == MT_RING);
|
||||
return (thing->type == MT_RING || thing->type == MT_BLUESPHERE);
|
||||
|
||||
default:
|
||||
return false;
|
||||
|
|
|
@ -1436,19 +1436,33 @@ static void R_ProjectBoundingBox(mobj_t *thing, vissprite_t *vis)
|
|||
return;
|
||||
}
|
||||
|
||||
// uncapped/interpolation
|
||||
boolean interpolate = cv_renderhitboxinterpolation.value;
|
||||
interpmobjstate_t interp = {0};
|
||||
|
||||
// do interpolation
|
||||
if (R_UsingFrameInterpolation() && !paused && interpolate)
|
||||
{
|
||||
R_InterpolateMobjState(thing, rendertimefrac, &interp);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_InterpolateMobjState(thing, FRACUNIT, &interp);
|
||||
}
|
||||
|
||||
// 1--3
|
||||
// | |
|
||||
// 0--2
|
||||
|
||||
// start in the (0) corner
|
||||
gx = thing->x - thing->radius - viewx;
|
||||
gy = thing->y - thing->radius - viewy;
|
||||
gx = interp.x - thing->radius - viewx;
|
||||
gy = interp.y - thing->radius - viewy;
|
||||
|
||||
tz = FixedMul(gx, viewcos) + FixedMul(gy, viewsin);
|
||||
|
||||
// thing is behind view plane?
|
||||
// if parent vis is visible, ignore this
|
||||
if (!vis && (tz < FixedMul(MINZ, thing->scale)))
|
||||
if (!vis && (tz < FixedMul(MINZ, interp.scale)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1473,7 +1487,7 @@ static void R_ProjectBoundingBox(mobj_t *thing, vissprite_t *vis)
|
|||
box->scale = 2 * FixedMul(thing->radius, viewsin);
|
||||
box->xscale = 2 * FixedMul(thing->radius, viewcos);
|
||||
|
||||
box->pz = thing->z;
|
||||
box->pz = interp.z;
|
||||
box->pzt = box->pz + box->thingheight;
|
||||
|
||||
box->gzt = box->pzt;
|
||||
|
|
|
@ -199,7 +199,7 @@ extern CV_PossibleValue_t cv_renderer_t[];
|
|||
extern INT32 scr_bpp;
|
||||
extern UINT8 *scr_borderpatch; // patch used to fill the view borders
|
||||
|
||||
extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_renderer, cv_renderhitbox, cv_fullscreen;
|
||||
extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_renderer, cv_renderhitbox, cv_renderhitboxinterpolation, cv_fullscreen;
|
||||
// wait for page flipping to end or not
|
||||
extern consvar_t cv_vidwait;
|
||||
extern consvar_t cv_timescale;
|
||||
|
|
Loading…
Reference in a new issue