#include "Camera.h" #include "Fog.h" #include "Models.h" #include "Sprites.h" #include "Support.h" extern float multiplier; extern bool slomo; extern Fog fog; extern bool blood; extern float fogcolorr; extern float fogcolorg; extern float fogcolorb; //Functions extern float sinefluct; extern int environment; extern Model gunmodels[10]; extern Camera camera; extern float precipitationhorz; extern float precipitationvert; extern float precipitationdensity; extern float snowdelay; int Sprites::MakeSprite(int atype, float abrightness, float acolor1, float acolor2, float acolor3, XYZ alocation, XYZ avelocity, float asize){ type[howmanysprites]=atype; rotation[howmanysprites]=Random()%360; brightness[howmanysprites]=abrightness; color1[howmanysprites]=acolor1; color2[howmanysprites]=acolor2; color3[howmanysprites]=acolor3; location[howmanysprites]=alocation; oldlocation[howmanysprites]=alocation; velocity[howmanysprites]=avelocity; size[howmanysprites]=asize; initialsize[howmanysprites]=asize; initialbrightness[howmanysprites]=abrightness; initialvelocity[howmanysprites]=avelocity; alivetime[howmanysprites]=0; owner[howmanysprites]=0; if(howmanysprites=0){ location[which]=location[howmanysprites-1]; oldlocation[which]=oldlocation[howmanysprites-1]; velocity[which]=velocity[howmanysprites-1]; initialsize[which]=initialsize[howmanysprites-1]; size[which]=size[howmanysprites-1]; brightness[which]=brightness[howmanysprites-1]; initialbrightness[which]=initialbrightness[howmanysprites-1]; color1[which]=color1[howmanysprites-1]; color2[which]=color2[howmanysprites-1]; color3[which]=color3[howmanysprites-1]; alivetime[which]=alivetime[howmanysprites-1]; rotation[which]=rotation[howmanysprites-1]; type[which]=type[howmanysprites-1]; type[howmanysprites-1]=0; if(howmanysprites>0){howmanysprites--;} } return 0; } void Sprites::DoStuff() { for(int i=0;i0){ velocity[i].y+=gravity*multiplier; rotation[i]+=multiplier*2; } } if(type[i]==bloodspritedown||type[i]==particlesspritedown){ velocity[i].y+=gravity*multiplier; } if(type[i]!=bulletinstant&&type[i]!=bullet)location[i]=location[i]+velocity[i]*multiplier; alivetime[i]+=multiplier; if(brightness[i]<=0)DeleteSprite(i); if(type[i]==snowsprite&&(location[i].y<-.1||environment!=snowy_environment))DeleteSprite(i); if(type[i]==rainsprite&&(location[i].y<-.1||environment!=rainy_environment))DeleteSprite(i); if(type[i]==snowsprite){ if(location[i].xcamera.position.x+precipitationhorz){location[i].x-=precipitationhorz*2;} if(location[i].z>camera.position.z+precipitationhorz){location[i].z-=precipitationhorz*2;} if(location[i].y>camera.position.y+precipitationvert){location[i].y-=precipitationvert*2;} } if(type[i]==rainsprite){ if(location[i].xcamera.position.x+precipitationhorz*.5){location[i].x-=precipitationhorz;} if(location[i].z>camera.position.z+precipitationhorz*.5){location[i].z-=precipitationhorz;} if(location[i].y>camera.position.y+precipitationvert){location[i].y-=precipitationvert*2;} } } } void Sprites::draw() { float M[16]; XYZ begProj,endProj,avgProj,persp; float oolen,dx,dy; float bulletsize; XYZ point; glAlphaFunc(GL_GREATER, 0.01); //glEnable(GL_POLYGON_OFFSET_FILL); glEnable(GL_BLEND); glDisable(GL_CULL_FACE); glEnable(GL_TEXTURE_2D); glDisable(GL_LIGHTING); glDepthMask(0); glAlphaFunc(GL_GREATER, 0.01); for(int i=0;i