X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FSprite.cpp;h=79a5af45a6cf37150524e7f5acd789e03f84f50a;hb=12421cc17c6176a16ec18901e02d760ccd0b28ad;hp=f0991afc4be6fbf73b15af2fb52d77b8ff95c457;hpb=de7834267e2ff8f28a2cb49647fc91e060686e93;p=lugaru.git diff --git a/Source/Sprite.cpp b/Source/Sprite.cpp index f0991af..79a5af4 100644 --- a/Source/Sprite.cpp +++ b/Source/Sprite.cpp @@ -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&&whichpatchxoldposition; 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 ); }