summary refs log tree commit diff
path: root/src/Decals.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Decals.cpp')
-rw-r--r--src/Decals.cpp42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/Decals.cpp b/src/Decals.cpp
index 3cebb4c..7617420 100644
--- a/src/Decals.cpp
+++ b/src/Decals.cpp
@@ -26,21 +26,20 @@ int Decals::MakeDecal(int atype, XYZ location, float size, XYZ normal, int poly,
 	XYZ nothing;
 	XYZ axis[3];
 	XYZ temp;
-	
+
 	nothing=0;
-	
+
 	axis[0].x=1;
 	axis[1].y=1;
 	axis[2].z=1;
-	
+
 	normalv[0]=abs(normal.x);
 	normalv[1]=abs(normal.y);
 	normalv[2]=abs(normal.z);
-	
-	
+
 	if(normalv[1]>normalv[major])major=1;
 	if(normalv[2]>normalv[major])major=2;
-	
+
 	if (normalv[0] == 1 || normalv[1] == 1 || normalv[2] == 1)
 	{
 	if ((major == 0 && normal.x > 0) || major == 1){
@@ -55,11 +54,11 @@ int Decals::MakeDecal(int atype, XYZ location, float size, XYZ normal, int poly,
    	}
    	else
     	CrossProduct(axis[major], normal, &right);
-   
+
     CrossProduct(normal, right, &up);
-    Normalise(&up); 
+    Normalise(&up);
     Normalise(&right);
-	
+
 	float count;
 	float count2;
 	float countinc=1/size;
@@ -67,7 +66,7 @@ int Decals::MakeDecal(int atype, XYZ location, float size, XYZ normal, int poly,
 	if(countinc>.2)countinc=.2;
 	float normaloffset=.02;
 	int good;
-	
+
 	numpoints[howmanydecals]=0;
     points[howmanydecals*8+numpoints[howmanydecals]] = location + (nothing - right - up) * (size/3) /*+ normal/100*/;
     texcoordsx[howmanydecals*8+numpoints[howmanydecals]] = 0;
@@ -113,7 +112,7 @@ int Decals::MakeDecal(int atype, XYZ location, float size, XYZ normal, int poly,
 	    	if(good!=-1)numpoints[howmanydecals]++;
     	}
     }
-    
+
     points[howmanydecals*8+numpoints[howmanydecals]] = location + (nothing + right - up) * (size/3) /*+ normal/100*/;
     texcoordsx[howmanydecals*8+numpoints[howmanydecals]] = 1;
     texcoordsy[howmanydecals*8+numpoints[howmanydecals]] = 0;
@@ -158,7 +157,7 @@ int Decals::MakeDecal(int atype, XYZ location, float size, XYZ normal, int poly,
 	    	if(good!=-1)numpoints[howmanydecals]++;
     	}
     }
-    
+
     points[howmanydecals*8+numpoints[howmanydecals]] = location + (nothing + right + up) * (size/3) /*+ normal/100*/;
     texcoordsx[howmanydecals*8+numpoints[howmanydecals]] = 1;
     texcoordsy[howmanydecals*8+numpoints[howmanydecals]] = 1;
@@ -203,7 +202,7 @@ int Decals::MakeDecal(int atype, XYZ location, float size, XYZ normal, int poly,
 	    	if(good!=-1)numpoints[howmanydecals]++;
     	}
     }
-    
+
     points[howmanydecals*8+numpoints[howmanydecals]] = location + (nothing - right + up) * (size/3) /*+ normal/100*/;
 	texcoordsx[howmanydecals*8+numpoints[howmanydecals]] = 0;
     texcoordsy[howmanydecals*8+numpoints[howmanydecals]] = 1;
@@ -251,7 +250,7 @@ int Decals::MakeDecal(int atype, XYZ location, float size, XYZ normal, int poly,
     for(int i=0;i<numpoints[howmanydecals];i++){
     	 points[howmanydecals*8+i] += normal*normaloffset;
     }
-    
+
     type[howmanydecals]=atype;
 	alivetime[howmanydecals]=0;
 	if(howmanydecals<maxdecals){howmanydecals++;}
@@ -271,7 +270,7 @@ int Decals::DeleteDecal(int which){
 	    }
 		if(howmanydecals>0){howmanydecals--;}
 	}
-	
+
 	return 0;
 }
 
@@ -302,9 +301,9 @@ void Decals::DoStuff()
 void Decals::draw()
 {
 	glAlphaFunc(GL_GREATER, 0.01);
-	
+
 	float bloodpoolspeed=1;
-	
+
 	glDepthFunc(GL_LEQUAL);
 	glEnable(GL_BLEND);
 	glEnable(GL_CULL_FACE);
@@ -320,7 +319,7 @@ void Decals::draw()
 		if(type[i]==bullethole)glBindTexture(GL_TEXTURE_2D, bulletholetextureptr);
 		if(type[i]==crater)glBindTexture(GL_TEXTURE_2D, cratertextureptr);
 		if(type[i]!=bloodpool)glColor4f(1,1,1,10-alivetime[i]);
-		
+
 		if(type[i]==bloodpool&&alivetime[i]<bloodpoolspeed*.2)glBindTexture(GL_TEXTURE_2D, bloodtextureptr[0]);
 		if(type[i]==bloodpool&&alivetime[i]>=bloodpoolspeed*.2&&alivetime[i]<bloodpoolspeed*.4)glBindTexture(GL_TEXTURE_2D, bloodtextureptr[1]);
 		if(type[i]==bloodpool&&alivetime[i]>=bloodpoolspeed*.4&&alivetime[i]<bloodpoolspeed*.6)glBindTexture(GL_TEXTURE_2D, bloodtextureptr[2]);
@@ -334,7 +333,7 @@ void Decals::draw()
 		if(type[i]==bloodpool&&alivetime[i]>=bloodpoolspeed*2.0)glBindTexture(GL_TEXTURE_2D, bloodtextureptr[10]);
 		if(type[i]==bloodpool&&alivetime[i]<bloodpoolspeed*2.0)glColor4f(1,1,1,1.5-(alivetime[i]*5/bloodpoolspeed-(int)(alivetime[i]*5/bloodpoolspeed)));
 		if(type[i]==bloodpool&&alivetime[i]>=bloodpoolspeed*2.0)glColor4f(1,1,1,20-alivetime[i]);
-		
+
 		glPushMatrix();
 		glBegin(GL_TRIANGLE_FAN);
 			for(int j=0;j<numpoints[i];j++){
@@ -342,7 +341,7 @@ void Decals::draw()
 			}
 		glEnd();
 		glPopMatrix();
-		
+
 		if(type[i]==bloodpool&&alivetime[i]<bloodpoolspeed*2.0){
 			if(type[i]==bloodpool&&alivetime[i]<bloodpoolspeed*.2)glBindTexture(GL_TEXTURE_2D, bloodtextureptr[1]);
 		if(type[i]==bloodpool&&alivetime[i]>=bloodpoolspeed*.2&&alivetime[i]<bloodpoolspeed*.4)glBindTexture(GL_TEXTURE_2D, bloodtextureptr[2]);
@@ -355,7 +354,7 @@ void Decals::draw()
 		if(type[i]==bloodpool&&alivetime[i]>=bloodpoolspeed*1.6&&alivetime[i]<bloodpoolspeed*1.8)glBindTexture(GL_TEXTURE_2D, bloodtextureptr[9]);
 		if(type[i]==bloodpool&&alivetime[i]>=bloodpoolspeed*1.8&&alivetime[i]<bloodpoolspeed*2.0)glBindTexture(GL_TEXTURE_2D, bloodtextureptr[10]);
 		if(type[i]==bloodpool)glColor4f(1,1,1,alivetime[i]*5/bloodpoolspeed-(int)(alivetime[i]*5/bloodpoolspeed));
-			
+
 			glPushMatrix();
 			glBegin(GL_TRIANGLE_FAN);
 				for(int j=0;j<numpoints[i];j++){
@@ -372,4 +371,3 @@ void Decals::draw()
 	glDisable(GL_POLYGON_OFFSET_FILL);
 	glDepthFunc(GL_LEQUAL);
 }
-