Use multiple for particle sizes

This commit is contained in:
Denis Pauk 2018-04-10 23:09:36 +03:00
parent 758ab07a38
commit cd6c686980
3 changed files with 8 additions and 16 deletions

View file

@ -389,7 +389,7 @@ surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel);
extern int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle; extern int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle;
extern int d_pix_min, d_pix_max, d_pix_shift; extern int d_pix_min, d_pix_max, d_pix_mul;
extern pixel_t *d_viewbuffer; extern pixel_t *d_viewbuffer;
extern zvalue_t *d_pzbuffer; extern zvalue_t *d_pzbuffer;

View file

@ -40,7 +40,7 @@ static int r_frustum_indexes[4*6];
static float basemip[NUM_MIPS-1] = {1.0, 0.5*0.8, 0.25*0.8}; static float basemip[NUM_MIPS-1] = {1.0, 0.5*0.8, 0.25*0.8};
int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle; int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle;
float xcenter, ycenter; float xcenter, ycenter;
int d_pix_min, d_pix_max, d_pix_shift; int d_pix_min, d_pix_max, d_pix_mul;
/* /*
================ ================
@ -64,18 +64,7 @@ D_ViewChanged (void)
if (d_pix_max < 1) if (d_pix_max < 1)
d_pix_max = 1; d_pix_max = 1;
if(r_newrefdef.height >= 600) d_pix_mul = (int)((float)r_refdef.vrect.height / 240.0 + 0.5);
{
d_pix_shift = 16 - (int)((float)r_refdef.vrect.height / 240.0 + 0.5);
}
else if(r_newrefdef.height >= 480)
{
d_pix_shift = 12 - (int)((float)r_refdef.vrect.height / 240.0 + 0.5);
}
else
{
d_pix_shift = 8 - (int)((float)r_refdef.vrect.height / 240.0 + 0.5);
}
d_vrectx = r_refdef.vrect.x; d_vrectx = r_refdef.vrect.x;
d_vrecty = r_refdef.vrect.y; d_vrecty = r_refdef.vrect.y;

View file

@ -96,7 +96,7 @@ static void R_DrawParticle(partparms_t *partparms)
** determine the screen area covered by the particle, ** determine the screen area covered by the particle,
** which also means clamping to a min and max ** which also means clamping to a min and max
*/ */
pix = izi >> d_pix_shift; pix = (izi * d_pix_mul) >> 8;
if (pix < d_pix_min) if (pix < d_pix_min)
pix = d_pix_min; pix = d_pix_min;
else if (pix > d_pix_max) else if (pix > d_pix_max)
@ -124,6 +124,8 @@ static void R_DrawParticle(partparms_t *partparms)
break; break;
case PARTICLE_66 : case PARTICLE_66 :
{
int color_part = (color<<8);
for ( ; count ; count--, pz += d_zwidth, pdest += r_screenwidth) for ( ; count ; count--, pz += d_zwidth, pdest += r_screenwidth)
{ {
for (i=0 ; i<pix ; i++) for (i=0 ; i<pix ; i++)
@ -131,11 +133,12 @@ static void R_DrawParticle(partparms_t *partparms)
if (pz[i] <= izi) if (pz[i] <= izi)
{ {
pz[i] = izi; pz[i] = izi;
pdest[i] = vid_alphamap[(color<<8) + (int)pdest[i]]; pdest[i] = vid_alphamap[color_part + (int)pdest[i]];
} }
} }
} }
break; break;
}
default: //100 default: //100
for ( ; count ; count--, pz += d_zwidth, pdest += r_screenwidth) for ( ; count ; count--, pz += d_zwidth, pdest += r_screenwidth)