Fix scaling
This commit is contained in:
1 parent
432335dc8b
commit
f7918b6f8e
6 files changed
+71
-34
No files matched your search
@@ -4947,13 +4947,12 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
R_InterpolateMobjState(thing, FRACUNIT, &interp);
|
||||
}
|
||||
|
||||
if (thing->spritexscale < 1 || thing->spriteyscale < 1)
|
||||
if (interp.spritexscale < 1 || interp.spriteyscale < 1)
|
||||
return;
|
||||
|
||||
this_scale = FIXED_TO_FLOAT(interp.scale);
|
||||
spritexscale = FIXED_TO_FLOAT(thing->spritexscale);
|
||||
spriteyscale = FIXED_TO_FLOAT(thing->spriteyscale);
|
||||
|
||||
spritexscale = FIXED_TO_FLOAT(interp.spritexscale);
|
||||
spriteyscale = FIXED_TO_FLOAT(interp.spriteyscale);
|
||||
|
||||
// transform the origin point
|
||||
tr_x = FIXED_TO_FLOAT(interp.x) - gr_viewx;
|
||||
@@ -5091,8 +5090,8 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
|
||||
if (thing->renderflags & RF_ABSOLUTEOFFSETS)
|
||||
{
|
||||
spr_offset = thing->spritexoffset;
|
||||
spr_topoffset = thing->spriteyoffset;
|
||||
spr_offset = interp.spritexoffset;
|
||||
spr_topoffset = interp.spriteyoffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -5101,8 +5100,8 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
if ((thing->renderflags & RF_FLIPOFFSETS) && flip)
|
||||
flipoffset = -1;
|
||||
|
||||
spr_offset += thing->spritexoffset * flipoffset;
|
||||
spr_topoffset += thing->spriteyoffset * flipoffset;
|
||||
spr_offset += interp.spritexoffset * flipoffset;
|
||||
spr_topoffset += interp.spriteyoffset * flipoffset;
|
||||
}
|
||||
|
||||
if (papersprite)
|
||||
|
||||
@@ -293,6 +293,8 @@ typedef struct mobj_s
|
||||
UINT32 renderflags; // render flags
|
||||
fixed_t spritexscale, spriteyscale;
|
||||
fixed_t spritexoffset, spriteyoffset;
|
||||
fixed_t old_spritexscale, old_spriteyscale;
|
||||
fixed_t old_spritexoffset, old_spriteyoffset;
|
||||
|
||||
fixed_t realxscale, realyscale; // funn-E streeetch
|
||||
|
||||
@@ -428,6 +430,8 @@ typedef struct precipmobj_s
|
||||
UINT32 renderflags; // render flags
|
||||
fixed_t spritexscale, spriteyscale;
|
||||
fixed_t spritexoffset, spriteyoffset;
|
||||
fixed_t old_spritexscale, old_spriteyscale;
|
||||
fixed_t old_spritexoffset, old_spriteyoffset;
|
||||
|
||||
fixed_t realxscale, realyscale; // funn-E streeetch
|
||||
|
||||
|
||||
@@ -2394,8 +2394,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
camera[i].x += x;
|
||||
camera[i].y += y;
|
||||
camera[i].z += z;
|
||||
camera[i].reset = true;
|
||||
camera[i].subsector = R_PointInSubsector(camera[i].x, camera[i].y);
|
||||
R_RelativeTeleportViewInterpolation(i, x, y, z, 0);
|
||||
R_ResetViewInterpolation(i + 1); // reset view interp as well
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+30
-1
@@ -280,6 +280,10 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
|
||||
out->scale = mobj->scale;
|
||||
out->subsector = mobj->subsector;
|
||||
out->angle = mobj->player ? mobj->player->frameangle : mobj->angle;
|
||||
out->spritexscale = mobj->spritexscale;
|
||||
out->spriteyscale = mobj->spriteyscale;
|
||||
out->spritexoffset = mobj->spritexoffset;
|
||||
out->spriteyoffset = mobj->spriteyoffset;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -287,7 +291,16 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
|
||||
out->y = R_LerpFixed(mobj->old_y, mobj->y, frac);
|
||||
out->z = R_LerpFixed(mobj->old_z, mobj->z, frac);
|
||||
out->scale = mobj->resetinterp ? mobj->scale : R_LerpFixed(mobj->old_scale, mobj->scale, frac);
|
||||
|
||||
out->spritexscale = mobj->resetinterp ? mobj->spritexscale : R_LerpFixed(mobj->old_spritexscale, mobj->spritexscale, frac);
|
||||
out->spriteyscale = mobj->resetinterp ? mobj->spriteyscale : R_LerpFixed(mobj->old_spriteyscale, mobj->spriteyscale, frac);
|
||||
out->spritexoffset = mobj->resetinterp ? mobj->spritexoffset : R_LerpFixed(mobj->old_spritexoffset, mobj->spritexoffset, frac);
|
||||
out->spriteyoffset = mobj->resetinterp ? mobj->spriteyoffset : R_LerpFixed(mobj->old_spriteyoffset, mobj->spriteyoffset, frac);
|
||||
|
||||
// Sprite offsets are not interpolated until we have a way to interpolate them explicitly in Lua.
|
||||
// It seems existing mods visually break more often than not if it is interpolated.
|
||||
out->spritexoffset = mobj->spritexoffset;
|
||||
out->spriteyoffset = mobj->spriteyoffset;
|
||||
|
||||
out->subsector = R_PointInSubsector(out->x, out->y);
|
||||
|
||||
if (mobj->player)
|
||||
@@ -310,6 +323,10 @@ void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjst
|
||||
out->scale = FRACUNIT;
|
||||
out->subsector = mobj->subsector;
|
||||
out->angle = mobj->angle;
|
||||
out->spritexscale = mobj->spritexscale;
|
||||
out->spriteyscale = mobj->spriteyscale;
|
||||
out->spritexoffset = mobj->spritexoffset;
|
||||
out->spriteyoffset = mobj->spriteyoffset;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -317,6 +334,10 @@ void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjst
|
||||
out->y = R_LerpFixed(mobj->old_y, mobj->y, frac);
|
||||
out->z = R_LerpFixed(mobj->old_z, mobj->z, frac);
|
||||
out->scale = FRACUNIT;
|
||||
out->spritexscale = R_LerpFixed(mobj->old_spritexscale, mobj->spritexscale, frac);
|
||||
out->spriteyscale = R_LerpFixed(mobj->old_spriteyscale, mobj->spriteyscale, frac);
|
||||
out->spritexoffset = R_LerpFixed(mobj->old_spritexoffset, mobj->spritexoffset, frac);
|
||||
out->spriteyoffset = R_LerpFixed(mobj->old_spriteyoffset, mobj->spriteyoffset, frac);
|
||||
|
||||
out->subsector = R_PointInSubsector(out->x, out->y);
|
||||
|
||||
@@ -742,6 +763,10 @@ void R_ResetMobjInterpolationState(mobj_t *mobj)
|
||||
mobj->old_z = mobj->z;
|
||||
mobj->old_angle = mobj->angle;
|
||||
mobj->old_scale = mobj->scale;
|
||||
mobj->old_spritexscale = mobj->spritexscale;
|
||||
mobj->old_spriteyscale = mobj->spriteyscale;
|
||||
mobj->old_spritexoffset = mobj->spritexoffset;
|
||||
mobj->old_spriteyoffset = mobj->spriteyoffset;
|
||||
|
||||
if (mobj->player)
|
||||
{
|
||||
@@ -767,4 +792,8 @@ void R_ResetPrecipitationMobjInterpolationState(precipmobj_t *mobj)
|
||||
mobj->old_y = mobj->y;
|
||||
mobj->old_z = mobj->z;
|
||||
mobj->old_angle = mobj->angle;
|
||||
mobj->old_spritexscale = mobj->spritexscale;
|
||||
mobj->old_spriteyscale = mobj->spriteyscale;
|
||||
mobj->old_spritexoffset = mobj->spritexoffset;
|
||||
mobj->old_spriteyoffset = mobj->spriteyoffset;
|
||||
}
|
||||
@@ -60,6 +60,10 @@ typedef struct {
|
||||
subsector_t *subsector;
|
||||
angle_t angle;
|
||||
fixed_t scale;
|
||||
fixed_t spritexscale;
|
||||
fixed_t spriteyscale;
|
||||
fixed_t spritexoffset;
|
||||
fixed_t spriteyoffset;
|
||||
} interpmobjstate_t;
|
||||
|
||||
// Level interpolators
|
||||
|
||||
+24
-25
@@ -140,7 +140,7 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch
|
||||
|
||||
if (maxframe ==(size_t)-1 || frame > maxframe)
|
||||
maxframe = frame;
|
||||
|
||||
|
||||
// rotsprite
|
||||
#ifdef ROTSPRITE
|
||||
for (r = 0; r < 16; r++)
|
||||
@@ -961,7 +961,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
|
||||
if (vis->x2 >= vid.width)
|
||||
vis->x2 = vid.width-1;
|
||||
|
||||
|
||||
lengthcol = patch->height;
|
||||
|
||||
#if 1
|
||||
@@ -979,7 +979,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
fixed_t scalestep = FixedMul(vis->scalestep, vis->spriteyscale);
|
||||
if (vis->scalestep) // currently papersprites only
|
||||
{
|
||||
|
||||
|
||||
#ifndef RANGECHECK
|
||||
if ((frac>>FRACBITS) < 0 || (frac>>FRACBITS) >= SHORT(patch->width)) // if this doesn't work i'm removing papersprites
|
||||
break;
|
||||
@@ -1208,7 +1208,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
fixed_t gz, gzt;
|
||||
INT32 heightsec, phs;
|
||||
INT32 light = 0;
|
||||
fixed_t this_scale = thing->scale;
|
||||
fixed_t this_scale;
|
||||
fixed_t spritexscale, spriteyscale;
|
||||
|
||||
// rotsprite
|
||||
@@ -1229,11 +1229,11 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
// do interpolation
|
||||
if (R_UsingFrameInterpolation() && !paused)
|
||||
{
|
||||
R_InterpolateMobjState(thing, rendertimefrac, &interp);
|
||||
R_InterpolateMobjState(oldthing, rendertimefrac, &interp);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_InterpolateMobjState(thing, FRACUNIT, &interp);
|
||||
R_InterpolateMobjState(oldthing, FRACUNIT, &interp);
|
||||
}
|
||||
|
||||
this_scale = interp.scale;
|
||||
@@ -1350,14 +1350,14 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
|
||||
if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES)
|
||||
this_scale = FixedMul(this_scale, ((skin_t *)thing->skin)->highresscale);
|
||||
|
||||
|
||||
spr_width = spritecachedinfo[lump].width;
|
||||
spr_height = spritecachedinfo[lump].height;
|
||||
spr_offset = spritecachedinfo[lump].offset;
|
||||
spr_topoffset = spritecachedinfo[lump].topoffset;
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
|
||||
|
||||
if (thing->player)
|
||||
{
|
||||
sliptiderollangle = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), ((cv_sliptideroll.value == 1) ? thing->player->sliproll*(thing->player->sliptidemem) : 0));
|
||||
@@ -1365,7 +1365,6 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
else
|
||||
sliptiderollangle = 0;
|
||||
|
||||
if ((thing->rollangle)||(thing->sloperoll)||sliptiderollangle)
|
||||
{
|
||||
if (thing->player)
|
||||
rollsum = (thing->rollangle) + (thing->sloperoll) + sliptiderollangle;
|
||||
@@ -1374,7 +1373,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
|
||||
rollangle = R_GetRollAngle(rollsum);
|
||||
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, sprinfo, rollangle);
|
||||
|
||||
|
||||
if (rotsprite != NULL)
|
||||
{
|
||||
spr_width = rotsprite->width << FRACBITS;
|
||||
@@ -1382,7 +1381,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
spr_offset = rotsprite->leftoffset << FRACBITS;
|
||||
spr_topoffset = rotsprite->topoffset << FRACBITS;
|
||||
spr_topoffset += FEETADJUST;
|
||||
|
||||
|
||||
// flip -> rotate, not rotate -> flip
|
||||
flip = 0;
|
||||
}
|
||||
@@ -1390,15 +1389,15 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
#endif
|
||||
|
||||
// calculate edges of the shape
|
||||
spritexscale = thing->spritexscale;
|
||||
spriteyscale = thing->spriteyscale;
|
||||
spritexscale = interp.spritexscale;
|
||||
spriteyscale = interp.spriteyscale;
|
||||
if (spritexscale < 1 || spriteyscale < 1)
|
||||
return;
|
||||
|
||||
if (thing->renderflags & RF_ABSOLUTEOFFSETS)
|
||||
{
|
||||
spr_offset = thing->spritexoffset;
|
||||
spr_topoffset = thing->spriteyoffset;
|
||||
spr_offset = interp.spritexoffset;
|
||||
spr_topoffset = interp.spriteyoffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1407,10 +1406,10 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
if ((thing->renderflags & RF_FLIPOFFSETS) && flip)
|
||||
flipoffset = -1;
|
||||
|
||||
spr_offset += thing->spritexoffset * flipoffset;
|
||||
spr_topoffset += thing->spriteyoffset * flipoffset;
|
||||
spr_offset += interp.spritexoffset * flipoffset;
|
||||
spr_topoffset += interp.spriteyoffset * flipoffset;
|
||||
}
|
||||
|
||||
|
||||
if (flip)
|
||||
offset = spr_offset - spr_width;
|
||||
else
|
||||
@@ -1579,8 +1578,8 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
|
||||
vis->x1 = x1 < 0 ? 0 : x1;
|
||||
vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2;
|
||||
|
||||
vis->sector = interp.subsector->sector;
|
||||
|
||||
vis->sector = thing->subsector->sector;
|
||||
vis->szt = (INT16)((centeryfrac - FixedMul(vis->gzt - viewz, sortscale))>>FRACBITS);
|
||||
vis->sz = (INT16)((centeryfrac - FixedMul(vis->gz - viewz, sortscale))>>FRACBITS);
|
||||
vis->cut = SC_NONE;
|
||||
@@ -1630,7 +1629,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
vis->thingscale = interp.scale;
|
||||
|
||||
//Fab: lumppat is the lump number of the patch to use, this is different
|
||||
// than lumpid for sprites-in-pwad : the graphics are patched
|
||||
// than lumpid for sprites-in-pwad : the graphics are patched
|
||||
#ifdef ROTSPRITE
|
||||
if (rotsprite != NULL)
|
||||
vis->patch = rotsprite;
|
||||
@@ -2679,14 +2678,14 @@ void R_ClipSprites(void)
|
||||
// e6y: ~13% of speed improvement on sunder.wad map10
|
||||
if (ds->x1 < cx)
|
||||
{
|
||||
drawsegs_xranges[1].items[drawsegs_xranges[1].count] =
|
||||
drawsegs_xranges[1].items[drawsegs_xranges[1].count] =
|
||||
drawsegs_xranges[0].items[drawsegs_xranges[0].count];
|
||||
drawsegs_xranges[1].count++;
|
||||
}
|
||||
|
||||
if (ds->x2 >= cx)
|
||||
{
|
||||
drawsegs_xranges[2].items[drawsegs_xranges[2].count] =
|
||||
drawsegs_xranges[2].items[drawsegs_xranges[2].count] =
|
||||
drawsegs_xranges[0].items[drawsegs_xranges[0].count];
|
||||
drawsegs_xranges[2].count++;
|
||||
}
|
||||
@@ -3014,7 +3013,7 @@ static int skinSortFunc(const void *a, const void *b) //tbh i have no clue what
|
||||
|
||||
|
||||
//return (strcmp(in1->realname, in2->realname) < 0) || (strcmp(in1->realname, in2->realname) ==);
|
||||
|
||||
|
||||
switch (cv_skinselectgridsort.value)
|
||||
{
|
||||
case SKINMENUSORT_REALNAME:
|
||||
@@ -3398,7 +3397,7 @@ next_token:
|
||||
}
|
||||
|
||||
sortSkinGrid();
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user