]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Sprite.cpp
fix one-pixel offset introduced in menu cleanup
[lugaru.git] / Source / Sprite.cpp
index f0991afc4be6fbf73b15af2fb52d77b8ff95c457..79a5af45a6cf37150524e7f5acd789e03f84f50a 100644 (file)
@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "Sprite.h"
 #include "Person.h"
+#include "Game.h"
 extern XYZ viewer;
 extern float viewdistance;
 extern float fadestart;
@@ -33,11 +34,8 @@ extern Terrain terrain;
 extern Objects objects;
 extern int detail;
 extern XYZ viewerfacing;
-extern float terraindetail;
 extern int bloodtoggle;
 extern XYZ windvector;
-extern int numplayers;
-extern Person player[maxplayers];
 
 // init statics
 GLuint Sprite::cloudtexture = 0;
@@ -312,11 +310,11 @@ void Sprite::Draw()
                                        if(!spritehit&&player[j].dead&&sprites[i]->alivetime>.1){
                                                where=sprites[i]->oldposition;
                                                where-=player[j].coords;
-                                               if(!player[j].skeleton.free)where=DoRotation(where,0,-player[j].rotation,0);
+                                               if(!player[j].skeleton.free)where=DoRotation(where,0,-player[j].yaw,0);
                                                startpoint=where;
                                                where=sprites[i]->position;
                                                where-=player[j].coords;
-                                               if(!player[j].skeleton.free)where=DoRotation(where,0,-player[j].rotation,0);
+                                               if(!player[j].skeleton.free)where=DoRotation(where,0,-player[j].yaw,0);
                                                endpoint=where;
 
                                                movepoint=0;
@@ -330,8 +328,8 @@ void Sprite::Draw()
                                        }
                                }
 
-                               whichpatchx=sprites[i]->position.x/(terrain.size/subdivision*terrain.scale*terraindetail);
-                               whichpatchz=sprites[i]->position.z/(terrain.size/subdivision*terrain.scale*terraindetail);
+                               whichpatchx=sprites[i]->position.x/(terrain.size/subdivision*terrain.scale);
+                               whichpatchz=sprites[i]->position.z/(terrain.size/subdivision*terrain.scale);
                                if(whichpatchx>0&&whichpatchz>0&&whichpatchx<subdivision&&whichpatchz<subdivision)
                                        if(terrain.patchobjectnum[whichpatchx][whichpatchz]){
                                                if(!spritehit)
@@ -340,8 +338,8 @@ void Sprite::Draw()
                                                                start=sprites[i]->oldposition;
                                                                end=sprites[i]->position;
                                                                if(!spritehit)
-                                                                       if(objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k])!=-1){
-                                                                               if(detail==2||(detail==1&&abs(Random()%4)==0)||(detail==0&&abs(Random()%8)==0))objects.model[k].MakeDecal(blooddecalfast,DoRotation(colpoint-objects.position[k],0,-objects.rotation[k],0),sprites[i]->size*1.6/*+abs((float)(Random()%100))/2400*/,.5,Random()%360);
+                                                                       if(objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.yaw[k])!=-1){
+                                                                               if(detail==2||(detail==1&&abs(Random()%4)==0)||(detail==0&&abs(Random()%8)==0))objects.model[k].MakeDecal(blooddecalfast,DoRotation(colpoint-objects.position[k],0,-objects.yaw[k],0),sprites[i]->size*1.6/*+abs((float)(Random()%100))/2400*/,.5,Random()%360);
                                                                                DeleteSprite(i);
                                                                                spritehit=1;
                                                                        }       
@@ -440,16 +438,16 @@ Sprite::Sprite()
 
 void Sprite::clearTextures()
 {
-       if (toothtexture) glDeleteTextures( 1, &toothtexture );
-       if (cloudtexture) glDeleteTextures( 1, &cloudtexture );
-       if (cloudimpacttexture) glDeleteTextures( 1, &cloudimpacttexture );
-       if (bloodtexture) glDeleteTextures( 1, &bloodtexture );
-       if (flametexture) glDeleteTextures( 1, &flametexture );
-       if (bloodflametexture) glDeleteTextures( 1, &bloodflametexture );
-       if (smoketexture) glDeleteTextures( 1, &smoketexture );
-       if (snowflaketexture) glDeleteTextures( 1, &snowflaketexture );
-       if (shinetexture) glDeleteTextures( 1, &shinetexture );
-       if (splintertexture) glDeleteTextures( 1, &splintertexture );
-       if (leaftexture) glDeleteTextures( 1, &leaftexture );
+       glDeleteTextures( 1, &toothtexture );
+       glDeleteTextures( 1, &cloudtexture );
+       glDeleteTextures( 1, &cloudimpacttexture );
+       glDeleteTextures( 1, &bloodtexture );
+       glDeleteTextures( 1, &flametexture );
+       glDeleteTextures( 1, &bloodflametexture );
+       glDeleteTextures( 1, &smoketexture );
+       glDeleteTextures( 1, &snowflaketexture );
+       glDeleteTextures( 1, &shinetexture );
+       glDeleteTextures( 1, &splintertexture );
+       glDeleteTextures( 1, &leaftexture );
 }