also scale precip sprite with mobjscale when cv_mobjscaleprecip enabled

This commit is contained in:
Alug committed 2024-09-04 18:48:08 +02:00
1 parent 94218a6549
commit 596c8e2ecc
4 files changed
+26 -17

No files matched your search

+8 -2
View File
@@ -5088,6 +5088,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
float x1, x2;
float z1, z2;
float rightsin, rightcos;
float this_scale;
spritedef_t *sprdef;
spriteframe_t *sprframe;
size_t lumpoff;
@@ -5120,6 +5121,8 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
R_InterpolatePrecipMobjState(thing, FRACUNIT, &interp);
}
this_scale = FIXED_TO_FLOAT(interp.scale);
// transform the origin point
tr_x = FIXED_TO_FLOAT(interp.x) - gr_viewx;
tr_y = FIXED_TO_FLOAT(interp.y) - gr_viewy;
@@ -5172,6 +5175,9 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
x2 = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width - spritecachedinfo[lumpoff].offset);
}
x1 *= this_scale;
x2 *= this_scale;
z1 = tr_y + x1 * rightsin;
z2 = tr_y - x2 * rightsin;
x1 = tr_x + x1 * rightcos;
@@ -5199,8 +5205,8 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
#endif
// set top/bottom coords
vis->gzt = FIXED_TO_FLOAT(interp.z + spritecachedinfo[lumpoff].topoffset);
vis->gz = vis->gzt - FIXED_TO_FLOAT(spritecachedinfo[lumpoff].height);
vis->gzt = FIXED_TO_FLOAT(interp.z) + (FIXED_TO_FLOAT(spritecachedinfo[lumpoff].topoffset) * this_scale);
vis->gz = vis->gzt - (FIXED_TO_FLOAT(spritecachedinfo[lumpoff].height) * this_scale);
vis->precip = true;
}
+2 -2
View File
@@ -379,7 +379,7 @@ void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjst
out->x = mobj->x;
out->y = mobj->y;
out->z = mobj->z;
out->scale = FRACUNIT;
out->scale = cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT;
out->subsector = mobj->subsector;
out->angle = mobj->angle;
out->spritexscale = mobj->spritexscale;
@@ -392,7 +392,7 @@ void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjst
out->x = R_LerpFixed(mobj->old_x, mobj->x, frac);
out->y = R_LerpFixed(mobj->old_y, mobj->y, frac);
out->z = R_LerpFixed(mobj->old_z, mobj->z, frac);
out->scale = FRACUNIT;
out->scale = cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT;
out->spritexscale = mobj->spritexscale;
out->spriteyscale = mobj->spriteyscale;
out->spritexoffset = mobj->spritexoffset;
+1 -2
View File
@@ -1686,7 +1686,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
lastopening = openings + pos;
if (oldopenings == NULL)
return;
return;
// borrowed fix from *cough* zdoom *cough*
// [RH] We also need to adjust the openings pointers that
@@ -2692,7 +2692,6 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (rover->norender == leveltime)
continue;
// Let the renderer know this sector is sloped.
if (*rover->b_slope || *rover->t_slope)
frontsector->hasslope = true;
+15 -11
View File
@@ -902,6 +902,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
INT32 texturecolumn;
fixed_t frac;
patch_t *patch;
fixed_t this_scale = vis->thingscale;
INT64 overflow_test;
//Fab : R_InitSprites now sets a wad lump number
@@ -925,7 +926,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
dc_colormap += COLORMAP_REMAPOFFSET;
dc_iscale = FixedDiv(FRACUNIT, vis->scale);
dc_texturemid = vis->texturemid;
dc_texturemid = FixedDiv(vis->texturemid, this_scale);
dc_texheight = 0;
frac = vis->startfrac;
@@ -1744,7 +1745,8 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
fixed_t iscale;
//SoM: 3/17/2000
fixed_t gz ,gzt;
fixed_t gz, gzt;
fixed_t this_scale;
INT32 dist = 1;
@@ -1770,6 +1772,8 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
R_InterpolatePrecipMobjState(thing, FRACUNIT, &interp);
}
this_scale = interp.scale;
// transform the origin point
tr_x = interp.x - viewx;
tr_y = interp.y - viewy;
@@ -1780,7 +1784,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
tz = gxt - gyt;
// thing is behind view plane?
if (tz < MINZ)
if (tz < FixedMul(MINZ, this_scale))
return;
gxt = -FixedMul(tr_x, viewsin);
@@ -1821,14 +1825,14 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
lump = sprframe->lumpid[0]; //Fab: see note above
// calculate edges of the shape
tx -= spritecachedinfo[lump].offset;
tx -= FixedMul(spritecachedinfo[lump].offset, this_scale);
x1 = (centerxfrac + FixedMul (tx,xscale)) >>FRACBITS;
// off the right side?
if (x1 > viewwidth)
return;
tx += spritecachedinfo[lump].width;
tx += FixedMul(spritecachedinfo[lump].width, this_scale);
x2 = ((centerxfrac + FixedMul (tx,xscale)) >>FRACBITS) - 1;
// off the left side
@@ -1846,8 +1850,8 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
}
//SoM: 3/17/2000: Disregard sprites that are out of view..
gzt = interp.z + spritecachedinfo[lump].topoffset;
gz = gzt - spritecachedinfo[lump].height;
gzt = interp.z + FixedMul(spritecachedinfo[lump].topoffset, this_scale);
gz = gzt - FixedMul(spritecachedinfo[lump].height, this_scale);
if (thing->subsector->sector->cullheight)
{
@@ -1857,7 +1861,9 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
// store information in a vissprite
vis = R_NewVisSprite();
vis->scale = vis->sortscale = yscale; //<<detailshift;
vis->scale = FixedMul(yscale, this_scale);
vis->sortscale = yscale; //<<detailshift;
vis->thingscale = interp.scale;
vis->dispoffset = 0; // Monster Iestyn: 23/11/15
vis->gx = interp.x;
vis->gy = interp.y;
@@ -1890,9 +1896,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
iscale = FixedDiv(FRACUNIT, xscale);
vis->startfrac = 0;
vis->xiscale = iscale;
vis->thingscale = interp.scale;
vis->xiscale = FixedDiv(iscale, this_scale);
if (vis->x1 > x1)
vis->startfrac += vis->xiscale*(vis->x1-x1);