summaryrefslogtreecommitdiff
path: root/src/sw_part.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sw_part.c')
-rw-r--r--src/sw_part.c66
1 files changed, 27 insertions, 39 deletions
diff --git a/src/sw_part.c b/src/sw_part.c
index 0fe15f6..8095ec0 100644
--- a/src/sw_part.c
+++ b/src/sw_part.c
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
@@ -25,8 +25,7 @@ vec3_t r_pright, r_pup, r_ppn;
#define PARTICLE_66 1
#define PARTICLE_OPAQUE 2
-typedef struct
-{
+typedef struct {
particle_t *particle;
int level;
int color;
@@ -43,11 +42,11 @@ static partparms_t partparms;
** executed is if we're debugging on x86 or if we're
** recompiling and deploying on a non-x86 platform.
**
-** To minimize error and improve readability I went the
+** To minimize error and improve readability I went the
** function pointer route. This exacts some overhead, but
** it pays off in clean and easy to understand code.
*/
-static void R_DrawParticle( void )
+static void R_DrawParticle(void)
{
particle_t *pparticle = partparms.particle;
int level = partparms.level;
@@ -61,11 +60,11 @@ static void R_DrawParticle( void )
/*
** transform the particle
*/
- VectorSubtract (pparticle->origin, r_origin, local);
+ VectorSubtract(pparticle->origin, r_origin, local);
transformed[0] = DotProduct(local, r_pright);
transformed[1] = DotProduct(local, r_pup);
- transformed[2] = DotProduct(local, r_ppn);
+ transformed[2] = DotProduct(local, r_ppn);
if (transformed[2] < PARTICLE_Z_CLIP)
return;
@@ -78,16 +77,15 @@ static void R_DrawParticle( void )
u = (int)(xcenter + zi * transformed[0] + 0.5);
v = (int)(ycenter - zi * transformed[1] + 0.5);
- if ((v > d_vrectbottom_particle) ||
+ if ((v > d_vrectbottom_particle) ||
(u > d_vrectright_particle) ||
(v < d_vrecty) ||
- (u < d_vrectx))
- {
+ (u < d_vrectx)) {
return;
}
/*
- ** compute addresses of zbuffer, framebuffer, and
+ ** compute addresses of zbuffer, framebuffer, and
** compute the Z-buffer reference value.
*/
pz = d_pzbuffer + (d_zwidth * v) + u;
@@ -111,41 +109,32 @@ static void R_DrawParticle( void )
switch (level) {
case PARTICLE_33 :
- for ( ; count ; count--, pz += d_zwidth, pdest += r_screenwidth)
- {
+ for (; count; count--, pz += d_zwidth, pdest += r_screenwidth) {
//FIXME--do it in blocks of 8?
- for (i=0 ; i<pix ; i++)
- {
- if (pz[i] <= izi)
- {
+ for (i = 0; i < pix; i++) {
+ if (pz[i] <= izi) {
pz[i] = izi;
- pdest[i] = vid.alphamap[color + ((int)pdest[i]<<8)];
+ pdest[i] = vid.alphamap[color + ((int)pdest[i] << 8)];
}
}
}
break;
case PARTICLE_66 :
- for ( ; count ; count--, pz += d_zwidth, pdest += r_screenwidth)
- {
- for (i=0 ; i<pix ; i++)
- {
- if (pz[i] <= izi)
- {
+ for (; count; count--, pz += d_zwidth, pdest += r_screenwidth) {
+ for (i = 0; i < pix; i++) {
+ if (pz[i] <= izi) {
pz[i] = izi;
- pdest[i] = vid.alphamap[(color<<8) + (int)pdest[i]];
+ pdest[i] = vid.alphamap[(color << 8) + (int)pdest[i]];
}
}
}
break;
default: //100
- for ( ; count ; count--, pz += d_zwidth, pdest += r_screenwidth)
- {
- for (i=0 ; i<pix ; i++)
- {
- if (pz[i] <= izi)
- {
+ for (; count; count--, pz += d_zwidth, pdest += r_screenwidth) {
+ for (i = 0; i < pix; i++) {
+ if (pz[i] <= izi) {
pz[i] = izi;
pdest[i] = color;
}
@@ -163,21 +152,20 @@ static void R_DrawParticle( void )
** if we're using the asm path, it simply assigns a function pointer
** and goes.
*/
-void R_DrawParticles (void)
+void R_DrawParticles(void)
{
particle_t *p;
int i;
- VectorScale( vright, xscaleshrink, r_pright );
- VectorScale( vup, yscaleshrink, r_pup );
- VectorCopy( vpn, r_ppn );
+ VectorScale(vright, xscaleshrink, r_pright);
+ VectorScale(vup, yscaleshrink, r_pup);
+ VectorCopy(vpn, r_ppn);
- for (p=r_newrefdef.particles, i=0 ; i<r_newrefdef.num_particles ; i++,p++)
- {
+ for (p = r_newrefdef.particles, i = 0; i < r_newrefdef.num_particles; i++, p++) {
- if ( p->alpha > 0.66 )
+ if (p->alpha > 0.66)
partparms.level = PARTICLE_OPAQUE;
- else if ( p->alpha > 0.33 )
+ else if (p->alpha > 0.33)
partparms.level = PARTICLE_66;
else
partparms.level = PARTICLE_33;