mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-06 08:02:55 +00:00
Scale precipitation to mapobjectscale
This commit is contained in:
parent
f609043b2e
commit
5b3f1b2c10
3 changed files with 24 additions and 12 deletions
|
|
@ -5564,6 +5564,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
float x1, x2;
|
float x1, x2;
|
||||||
float z1, z2;
|
float z1, z2;
|
||||||
float rightsin, rightcos;
|
float rightsin, rightcos;
|
||||||
|
float this_scale;
|
||||||
spritedef_t *sprdef;
|
spritedef_t *sprdef;
|
||||||
spriteframe_t *sprframe;
|
spriteframe_t *sprframe;
|
||||||
size_t lumpoff;
|
size_t lumpoff;
|
||||||
|
|
@ -5586,6 +5587,8 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
R_InterpolatePrecipMobjState(thing, FRACUNIT, &interp);
|
R_InterpolatePrecipMobjState(thing, FRACUNIT, &interp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this_scale = FIXED_TO_FLOAT(interp.scale);
|
||||||
|
|
||||||
// transform the origin point
|
// transform the origin point
|
||||||
tr_x = FIXED_TO_FLOAT(interp.x) - gl_viewx;
|
tr_x = FIXED_TO_FLOAT(interp.x) - gl_viewx;
|
||||||
tr_y = FIXED_TO_FLOAT(interp.y) - gl_viewy;
|
tr_y = FIXED_TO_FLOAT(interp.y) - gl_viewy;
|
||||||
|
|
@ -5638,6 +5641,9 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
x2 = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width - spritecachedinfo[lumpoff].offset);
|
x2 = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width - spritecachedinfo[lumpoff].offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
x1 *= this_scale;
|
||||||
|
x2 *= this_scale;
|
||||||
|
|
||||||
z1 = tr_y + x1 * rightsin;
|
z1 = tr_y + x1 * rightsin;
|
||||||
z2 = tr_y - x2 * rightsin;
|
z2 = tr_y - x2 * rightsin;
|
||||||
x1 = tr_x + x1 * rightcos;
|
x1 = tr_x + x1 * rightcos;
|
||||||
|
|
@ -5665,8 +5671,8 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// set top/bottom coords
|
// set top/bottom coords
|
||||||
vis->gzt = FIXED_TO_FLOAT(interp.z + spritecachedinfo[lumpoff].topoffset);
|
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);
|
vis->gz = vis->gzt - (FIXED_TO_FLOAT(spritecachedinfo[lumpoff].height) * this_scale);
|
||||||
|
|
||||||
vis->precip = true;
|
vis->precip = true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -316,7 +316,7 @@ void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjst
|
||||||
out->x = mobj->x;
|
out->x = mobj->x;
|
||||||
out->y = mobj->y;
|
out->y = mobj->y;
|
||||||
out->z = mobj->z;
|
out->z = mobj->z;
|
||||||
out->scale = FRACUNIT;
|
out->scale = mapobjectscale;
|
||||||
out->subsector = mobj->subsector;
|
out->subsector = mobj->subsector;
|
||||||
out->angle = mobj->angle;
|
out->angle = mobj->angle;
|
||||||
out->spritexscale = mobj->spritexscale;
|
out->spritexscale = mobj->spritexscale;
|
||||||
|
|
@ -329,7 +329,7 @@ void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjst
|
||||||
out->x = R_LerpFixed(mobj->old_x, mobj->x, frac);
|
out->x = R_LerpFixed(mobj->old_x, mobj->x, frac);
|
||||||
out->y = R_LerpFixed(mobj->old_y, mobj->y, frac);
|
out->y = R_LerpFixed(mobj->old_y, mobj->y, frac);
|
||||||
out->z = R_LerpFixed(mobj->old_z, mobj->z, frac);
|
out->z = R_LerpFixed(mobj->old_z, mobj->z, frac);
|
||||||
out->scale = FRACUNIT;
|
out->scale = mapobjectscale;
|
||||||
out->spritexscale = R_LerpFixed(mobj->old_spritexscale, mobj->spritexscale, frac);
|
out->spritexscale = R_LerpFixed(mobj->old_spritexscale, mobj->spritexscale, frac);
|
||||||
out->spriteyscale = R_LerpFixed(mobj->old_spriteyscale, mobj->spriteyscale, frac);
|
out->spriteyscale = R_LerpFixed(mobj->old_spriteyscale, mobj->spriteyscale, frac);
|
||||||
out->spritexoffset = R_LerpFixed(mobj->old_spritexoffset, mobj->spritexoffset, frac);
|
out->spritexoffset = R_LerpFixed(mobj->old_spritexoffset, mobj->spritexoffset, frac);
|
||||||
|
|
|
||||||
|
|
@ -1034,6 +1034,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
|
||||||
#endif
|
#endif
|
||||||
fixed_t frac;
|
fixed_t frac;
|
||||||
patch_t *patch;
|
patch_t *patch;
|
||||||
|
fixed_t this_scale = vis->thingscale;
|
||||||
INT64 overflow_test;
|
INT64 overflow_test;
|
||||||
|
|
||||||
//Fab : R_InitSprites now sets a wad lump number
|
//Fab : R_InitSprites now sets a wad lump number
|
||||||
|
|
@ -1061,7 +1062,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
|
||||||
}
|
}
|
||||||
|
|
||||||
dc_iscale = FixedDiv(FRACUNIT, vis->scale);
|
dc_iscale = FixedDiv(FRACUNIT, vis->scale);
|
||||||
dc_texturemid = vis->texturemid;
|
dc_texturemid = FixedDiv(vis->texturemid, this_scale);
|
||||||
dc_texheight = 0;
|
dc_texheight = 0;
|
||||||
|
|
||||||
frac = vis->startfrac;
|
frac = vis->startfrac;
|
||||||
|
|
@ -2187,6 +2188,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
|
|
||||||
//SoM: 3/17/2000
|
//SoM: 3/17/2000
|
||||||
fixed_t gz, gzt;
|
fixed_t gz, gzt;
|
||||||
|
fixed_t this_scale;
|
||||||
|
|
||||||
UINT32 blendmode;
|
UINT32 blendmode;
|
||||||
UINT32 trans;
|
UINT32 trans;
|
||||||
|
|
@ -2204,6 +2206,8 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
R_InterpolatePrecipMobjState(thing, FRACUNIT, &interp);
|
R_InterpolatePrecipMobjState(thing, FRACUNIT, &interp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this_scale = interp.scale;
|
||||||
|
|
||||||
// transform the origin point
|
// transform the origin point
|
||||||
tr_x = interp.x - viewx;
|
tr_x = interp.x - viewx;
|
||||||
tr_y = interp.y - viewy;
|
tr_y = interp.y - viewy;
|
||||||
|
|
@ -2211,7 +2215,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
tz = FixedMul(tr_x, viewcos) + FixedMul(tr_y, viewsin); // near/far distance
|
tz = FixedMul(tr_x, viewcos) + FixedMul(tr_y, viewsin); // near/far distance
|
||||||
|
|
||||||
// thing is behind view plane?
|
// thing is behind view plane?
|
||||||
if (tz < MINZ)
|
if (tz < FixedMul(MINZ, this_scale))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tx = FixedMul(tr_x, viewsin) - FixedMul(tr_y, viewcos); // sideways distance
|
tx = FixedMul(tr_x, viewsin) - FixedMul(tr_y, viewcos); // sideways distance
|
||||||
|
|
@ -2250,14 +2254,14 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
lump = sprframe->lumpid[0]; //Fab: see note above
|
lump = sprframe->lumpid[0]; //Fab: see note above
|
||||||
|
|
||||||
// calculate edges of the shape
|
// calculate edges of the shape
|
||||||
tx -= spritecachedinfo[lump].offset;
|
tx -= FixedMul(spritecachedinfo[lump].offset, this_scale);
|
||||||
x1 = (centerxfrac + FixedMul (tx,xscale)) >>FRACBITS;
|
x1 = (centerxfrac + FixedMul (tx,xscale)) >>FRACBITS;
|
||||||
|
|
||||||
// off the right side?
|
// off the right side?
|
||||||
if (x1 > viewwidth)
|
if (x1 > viewwidth)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tx += spritecachedinfo[lump].width;
|
tx += FixedMul(spritecachedinfo[lump].width, this_scale);
|
||||||
x2 = ((centerxfrac + FixedMul (tx,xscale)) >>FRACBITS) - 1;
|
x2 = ((centerxfrac + FixedMul (tx,xscale)) >>FRACBITS) - 1;
|
||||||
|
|
||||||
// off the left side
|
// off the left side
|
||||||
|
|
@ -2275,8 +2279,8 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
}
|
}
|
||||||
|
|
||||||
//SoM: 3/17/2000: Disregard sprites that are out of view..
|
//SoM: 3/17/2000: Disregard sprites that are out of view..
|
||||||
gzt = interp.z + spritecachedinfo[lump].topoffset;
|
gzt = interp.z + FixedMul(spritecachedinfo[lump].topoffset, this_scale);
|
||||||
gz = gzt - spritecachedinfo[lump].height;
|
gz = gzt - FixedMul(spritecachedinfo[lump].height, this_scale);
|
||||||
|
|
||||||
if (thing->subsector->sector->cullheight)
|
if (thing->subsector->sector->cullheight)
|
||||||
{
|
{
|
||||||
|
|
@ -2297,7 +2301,9 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
|
|
||||||
// store information in a vissprite
|
// store information in a vissprite
|
||||||
vis = R_NewVisSprite();
|
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->dispoffset = 0; // Monster Iestyn: 23/11/15
|
||||||
vis->gx = interp.x;
|
vis->gx = interp.x;
|
||||||
vis->gy = interp.y;
|
vis->gy = interp.y;
|
||||||
|
|
@ -2323,7 +2329,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
iscale = FixedDiv(FRACUNIT, xscale);
|
iscale = FixedDiv(FRACUNIT, xscale);
|
||||||
|
|
||||||
vis->startfrac = 0;
|
vis->startfrac = 0;
|
||||||
vis->xiscale = iscale;
|
vis->xiscale = FixedDiv(iscale, this_scale);
|
||||||
|
|
||||||
if (vis->x1 > x1)
|
if (vis->x1 > x1)
|
||||||
vis->startfrac += vis->xiscale*(vis->x1-x1);
|
vis->startfrac += vis->xiscale*(vis->x1-x1);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue