X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FWeapons.cpp;h=d250f1ee84676c50d008dbc35e4724ce22db42ac;hb=0b7253f3d99e4382008aff8b8e221e88ff40d3e9;hp=a3f8fc3127e7020b32cf6e3447f80f4df32bc91b;hpb=44146d06c780d3aaa283672fedb08b8870ebe1b9;p=lugaru.git diff --git a/Source/Weapons.cpp b/Source/Weapons.cpp index a3f8fc3..d250f1e 100644 --- a/Source/Weapons.cpp +++ b/Source/Weapons.cpp @@ -10,7 +10,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. @@ -21,15 +21,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /**> HEADER FILES <**/ #include "Weapons.h" +#include "openal_wrapper.h" +#include "Animation.h" +#include "Sounds.h" +#include "Game.h" +#include "Awards.h" extern float multiplier; -extern Animation animation[animation_count]; -extern FSOUND_SAMPLE *samp[100]; -extern int channels[100]; extern Terrain terrain; extern float gravity; extern int environment; -extern Sprites sprites; extern int detail; extern FRUSTUM frustum; extern XYZ viewer; @@ -45,22 +46,14 @@ extern bool osx; extern bool autoslomo; extern float camerashake; extern float woozy; -extern float terraindetail; extern float viewdistance; extern float blackout; extern int difficulty; -extern Person player[maxplayers]; -extern int numplayers; extern bool freeze; -extern int bonus; -extern float bonusvalue; -extern float bonustotal; -extern float bonustime; extern int tutoriallevel; extern int numthrowkill; -extern "C" void PlaySoundEx(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused); -void Weapons::DoStuff(){ +void Weapons::DoStuff(){ static int i,whichpatchx,whichpatchz,j,k,whichhit,m; static XYZ start,end,colpoint,normalrot,footvel,footpoint; static XYZ terrainnormal; @@ -89,35 +82,17 @@ void Weapons::DoStuff(){ oldowner[i]=owner[i]; } if(damage[i]>=2&&type[i]==staff&&owner[i]!=-1){ - float gLoc[3]; - float vel[3]; - gLoc[0]=tippoint[i].x; - gLoc[1]=tippoint[i].y; - gLoc[2]=tippoint[i].z; - vel[0]=0; - vel[1]=0; - vel[2]=0; - PlaySoundEx( staffbreaksound, samp[staffbreaksound], NULL, TRUE); - FSOUND_3D_SetAttributes(channels[staffbreaksound], gLoc, vel); - FSOUND_SetVolume(channels[staffbreaksound], 256); - FSOUND_SetPaused(channels[staffbreaksound], FALSE); + emit_sound_at(staffbreaksound, tippoint[i]); XYZ tempvel; XYZ speed; //speed=(tippoint[i]-oldtippoint[i])/multiplier/6; speed=0; - /*for(j=0;j<10;j++){ - tempvel.x=float(abs(Random()%100)-50)/20; - tempvel.y=float(abs(Random()%100)-50)/20; - tempvel.z=float(abs(Random()%100)-50)/20; - tempvel+=speed; - sprites.MakeSprite(cloudimpactsprite, position[i]+(tippoint[i]-position[i])*((float)j-2)/8,tempvel*.5, 115/255,73/255,12/255, .15+float(abs(Random()%100)-50)/1000, .7); - }*/ for(j=0;j<40;j++){ tempvel.x=float(abs(Random()%100)-50)/20; tempvel.y=float(abs(Random()%100)-50)/20; tempvel.z=float(abs(Random()%100)-50)/20; tempvel+=speed; - sprites.MakeSprite(splintersprite, position[i]+(tippoint[i]-position[i])*((float)j-8)/32,tempvel*.5, 115/255,73/255,12/255, .1, 1); + Sprite::MakeSprite(splintersprite, position[i]+(tippoint[i]-position[i])*((float)j-8)/32,tempvel*.5, 115/255,73/255,12/255, .1, 1); } int tempowner; tempowner=owner[i]; @@ -142,8 +117,8 @@ void Weapons::DoStuff(){ if(owner[i]==-1&&(velocity[i].x||velocity[i].y||velocity[i].z)&&!physics[i]){ position[i]+=velocity[i]*multiplier; tippoint[i]+=velocity[i]*multiplier; - whichpatchx=position[i].x/(terrain.size/subdivision*terrain.scale*terraindetail); - whichpatchz=position[i].z/(terrain.size/subdivision*terrain.scale*terraindetail); + whichpatchx=position[i].x/(terrain.size/subdivision*terrain.scale); + whichpatchz=position[i].z/(terrain.size/subdivision*terrain.scale); if(whichpatchx>0&&whichpatchz>0&&whichpatchx0&&whichpatchz>0&&whichpatchx1){ - float gLoc[3]; - float vel[3]; - //int whichsound=clank1sound+abs(Random()%4); int whichsound; if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2); - if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4);gLoc[0]=position[i].x; - gLoc[1]=position[i].y; - gLoc[2]=position[i].z; - vel[0]=0; - vel[1]=0; - vel[2]=0; - PlaySoundEx( whichsound, samp[whichsound], NULL, TRUE); - FSOUND_3D_SetAttributes(channels[whichsound], gLoc, vel); - FSOUND_SetVolume(channels[whichsound], 128*findLengthfast(&bounceness)); - FSOUND_SetPaused(channels[whichsound], FALSE); + if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4); + emit_sound_at(whichsound, position[i], 128*findLengthfast(&bounceness)); } } start=oldtippoint[i]; @@ -512,7 +426,7 @@ void Weapons::DoStuff(){ whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]); if(whichhit!=-1){ hitsomething[i]=1; - tippoint[i]=colpoint; + tippoint[i]=colpoint; terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.rotation[k],0)*-1; ReflectVector(&tipvelocity[i],&terrainnormal); tippoint[i]+=terrainnormal*.002; @@ -526,22 +440,10 @@ void Weapons::DoStuff(){ tipvelocity[i]+=bounceness*elasticity; if(findLengthfast(&bounceness)>1){ - float gLoc[3]; - float vel[3]; - //int whichsound=clank1sound+abs(Random()%4); int whichsound; if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2); - if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4);gLoc[0]=position[i].x; - gLoc[0]=position[i].x; - gLoc[1]=position[i].y; - gLoc[2]=position[i].z; - vel[0]=0; - vel[1]=0; - vel[2]=0; - PlaySoundEx( whichsound, samp[whichsound], NULL, TRUE); - FSOUND_3D_SetAttributes(channels[whichsound], gLoc, vel); - FSOUND_SetVolume(channels[whichsound], 128*findLengthfast(&bounceness)); - FSOUND_SetPaused(channels[whichsound], FALSE); + if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4); + emit_sound_at(whichsound, position[i], 128*findLengthfast(&bounceness)); } } @@ -556,7 +458,7 @@ void Weapons::DoStuff(){ whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]); if(whichhit!=-1){ hitsomething[i]=1; - mid=colpoint; + mid=colpoint; terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.rotation[k],0)*-1; ReflectVector(&velocity[i],&terrainnormal); @@ -569,21 +471,10 @@ void Weapons::DoStuff(){ velocity[i]+=bounceness*elasticity; if(findLengthfast(&bounceness)>1){ - float gLoc[3]; - float vel[3]; - //int whichsound=clank1sound+abs(Random()%4); int whichsound; if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2); - if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4);gLoc[0]=mid.x; - gLoc[1]=mid.y; - gLoc[2]=mid.z; - vel[0]=0; - vel[1]=0; - vel[2]=0; - PlaySoundEx( whichsound, samp[whichsound], NULL, TRUE); - FSOUND_3D_SetAttributes(channels[whichsound], gLoc, vel); - FSOUND_SetVolume(channels[whichsound], 128*findLengthfast(&bounceness)); - FSOUND_SetPaused(channels[whichsound], FALSE); + if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4); + emit_sound_at(whichsound, mid, 128*findLengthfast(&bounceness)); } position[i]+=(mid-oldmid2)*(20/(1+(float)m*10)); } @@ -597,7 +488,7 @@ void Weapons::DoStuff(){ whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]); if(whichhit!=-1){ hitsomething[i]=1; - mid=colpoint; + mid=colpoint; terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.rotation[k],0)*-1; ReflectVector(&tipvelocity[i],&terrainnormal); @@ -610,21 +501,10 @@ void Weapons::DoStuff(){ tipvelocity[i]+=bounceness*elasticity; if(findLengthfast(&bounceness)>1){ - float gLoc[3]; - float vel[3]; - //int whichsound=clank1sound+abs(Random()%4); int whichsound; if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2); - if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4);gLoc[0]=mid.x; - gLoc[1]=mid.y; - gLoc[2]=mid.z; - vel[0]=0; - vel[1]=0; - vel[2]=0; - PlaySoundEx( whichsound, samp[whichsound], NULL, TRUE); - FSOUND_3D_SetAttributes(channels[whichsound], gLoc, vel); - FSOUND_SetVolume(channels[whichsound], 128*findLengthfast(&bounceness)); - FSOUND_SetPaused(channels[whichsound], FALSE); + if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4); + emit_sound_at(whichsound, mid, 128*findLengthfast(&bounceness)); } tippoint[i]+=(mid-oldmid2)*(20/(1+(float)m*10)); } @@ -664,7 +544,7 @@ void Weapons::DoStuff(){ closestswordpoint=colpoint; velocity[i]+=(closestpoint-closestswordpoint); tipvelocity[i]+=(closestpoint-closestswordpoint); - position[i]+=(closestpoint-closestswordpoint); + position[i]+=(closestpoint-closestswordpoint); tippoint[i]+=(closestpoint-closestswordpoint); } } @@ -693,37 +573,29 @@ void Weapons::DoStuff(){ else velocity[i]+=bounceness*elasticity; //if (type[i]==knife) printf("velocity of knife %d now %f,%f,%f.\n", i, velocity[i].x, velocity[i].y, velocity[i].z); if(findLengthfast(&bounceness)>1){ - float gLoc[3]; - float vel[3]; int whichsound; if(terrain.getOpacity(position[i].x,position[i].z)>.2){ if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2); if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4); } else whichsound=footstepsound+abs(Random()%2); - gLoc[0]=position[i].x; - gLoc[1]=position[i].y; - gLoc[2]=position[i].z; - vel[0]=0; - vel[1]=0; - vel[2]=0; - PlaySoundEx( whichsound, samp[whichsound], NULL, TRUE); - FSOUND_3D_SetAttributes(channels[whichsound], gLoc, vel); - if(terrain.getOpacity(position[i].x,position[i].z)>.2)FSOUND_SetVolume(channels[whichsound], 128*findLengthfast(&bounceness)); - else FSOUND_SetVolume(channels[whichsound], 32*findLengthfast(&bounceness)); - FSOUND_SetPaused(channels[whichsound], FALSE); + emit_sound_at(whichsound, position[i], + findLengthfast(&bounceness) + * (terrain.getOpacity(position[i].x,position[i].z) > .2 + ? 128. + : 32.)); if(terrain.getOpacity(position[i].x,position[i].z)<.2){ XYZ terrainlight; terrainlight=terrain.getLighting(position[i].x,position[i].z); if(environment==snowyenvironment){ - if(findDistancefast(&position[i],&viewer)1){ - float gLoc[3]; - float vel[3]; int whichsound; if(terrain.getOpacity(tippoint[i].x,tippoint[i].z)>.2){ if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2); if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4); } else whichsound=footstepsound+abs(Random()%2); - gLoc[0]=tippoint[i].x; - gLoc[1]=tippoint[i].y; - gLoc[2]=tippoint[i].z; - vel[0]=0; - vel[1]=0; - vel[2]=0; - PlaySoundEx( whichsound, samp[whichsound], NULL, TRUE); - FSOUND_3D_SetAttributes(channels[whichsound], gLoc, vel); - if(terrain.getOpacity(tippoint[i].x,tippoint[i].z)>.2)FSOUND_SetVolume(channels[whichsound], 128*findLengthfast(&bounceness)); - else FSOUND_SetVolume(channels[whichsound], 32*findLengthfast(&bounceness)); - FSOUND_SetPaused(channels[whichsound], FALSE); + emit_sound_at(whichsound, tippoint[i], + findLengthfast(&bounceness) + * (terrain.getOpacity(tippoint[i].x,tippoint[i].z) > .2 + ? 128. + : 32.)); if(terrain.getOpacity(tippoint[i].x,tippoint[i].z)<.2){ XYZ terrainlight; terrainlight=terrain.getLighting(tippoint[i].x,tippoint[i].z); if(environment==snowyenvironment){ - if(findDistancefast(&tippoint[i],&viewer)1){ - float gLoc[3]; - float vel[3]; int whichsound; if(terrain.getOpacity(mid.x,mid.z)>.2){ if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2); if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4); } else whichsound=footstepsound+abs(Random()%2); - gLoc[0]=mid.x; - gLoc[1]=mid.y; - gLoc[2]=mid.z; - vel[0]=0; - vel[1]=0; - vel[2]=0; - PlaySoundEx( whichsound, samp[whichsound], NULL, TRUE); - FSOUND_3D_SetAttributes(channels[whichsound], gLoc, vel); - if(terrain.getOpacity(position[i].x,position[i].z)>.2)FSOUND_SetVolume(channels[whichsound], 128*findLengthfast(&bounceness)); - else FSOUND_SetVolume(channels[whichsound], 32*findLengthfast(&bounceness)); - FSOUND_SetPaused(channels[whichsound], FALSE); + emit_sound_at(whichsound, mid, + findLengthfast(&bounceness) + * (terrain.getOpacity(position[i].x,position[i].z) > .2 + ? 128. + : 32.)); } position[i]+=(mid-oldmid)*20; } @@ -849,184 +705,20 @@ void Weapons::DoStuff(){ else tipvelocity[i]+=bounceness*elasticity; if(findLengthfast(&bounceness)>1){ - float gLoc[3]; - float vel[3]; int whichsound; if(terrain.getOpacity(mid.x,mid.z)>.2){ if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2); if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4); } else whichsound=footstepsound+abs(Random()%2); - gLoc[0]=mid.x; - gLoc[1]=mid.y; - gLoc[2]=mid.z; - vel[0]=0; - vel[1]=0; - vel[2]=0; - PlaySoundEx( whichsound, samp[whichsound], NULL, TRUE); - FSOUND_3D_SetAttributes(channels[whichsound], gLoc, vel); - if(terrain.getOpacity(position[i].x,position[i].z)>.2)FSOUND_SetVolume(channels[whichsound], 128*findLengthfast(&bounceness)); - else FSOUND_SetVolume(channels[whichsound], 32*findLengthfast(&bounceness)); - FSOUND_SetPaused(channels[whichsound], FALSE); + emit_sound_at(whichsound, mid, + findLengthfast(&bounceness) + * (terrain.getOpacity(position[i].x,position[i].z) > .2 + ? 128. + : 32.)); } tippoint[i]+=(mid-oldmid)*20; } - /*XYZ mid; - mid=position[i]+tippoint[i]; - mid/=2; - if(position[i].y0)velocity[i]*=1-friction*frictionness; - else velocity[i]=0; - if(terrain.getOpacity(mid.x,mid.z)<.2)velocity[i]+=bounceness*elasticity*.3; - else velocity[i]+=bounceness*elasticity; - - if(findLengthfast(&bounceness)>1){ - float gLoc[3]; - float vel[3]; - int whichsound; - if(terrain.getOpacity(mid.x,mid.z)>.2){ - if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2); - if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4); - } - else whichsound=footstepsound+abs(Random()%2); - gLoc[0]=position[i].x; - gLoc[1]=position[i].y; - gLoc[2]=position[i].z; - vel[0]=0; - vel[1]=0; - vel[2]=0; - PlaySoundEx( whichsound, samp[whichsound], NULL, TRUE); - FSOUND_3D_SetAttributes(channels[whichsound], gLoc, vel); - if(terrain.getOpacity(position[i].x,position[i].z)>.2)FSOUND_SetVolume(channels[whichsound], 128*findLengthfast(&bounceness)); - else FSOUND_SetVolume(channels[whichsound], 32*findLengthfast(&bounceness)); - FSOUND_SetPaused(channels[whichsound], FALSE); - } - } - - if(tippoint[i].y0)tipvelocity[i]*=1-friction*frictionness; - else tipvelocity[i]=0; - if(terrain.getOpacity(mid.x,mid.z)<.2)tipvelocity[i]+=bounceness*elasticity*.3; - else tipvelocity[i]+=bounceness*elasticity; - - if(findLengthfast(&bounceness)>1){ - float gLoc[3]; - float vel[3]; - int whichsound; - if(terrain.getOpacity(mid.x,mid.z)>.2){ - if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2); - if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4); - } - else whichsound=footstepsound+abs(Random()%2); - gLoc[0]=tippoint[i].x; - gLoc[1]=tippoint[i].y; - gLoc[2]=tippoint[i].z; - vel[0]=0; - vel[1]=0; - vel[2]=0; - PlaySoundEx( whichsound, samp[whichsound], NULL, TRUE); - FSOUND_3D_SetAttributes(channels[whichsound], gLoc, vel); - if(terrain.getOpacity(tippoint[i].x,tippoint[i].z)>.2)FSOUND_SetVolume(channels[whichsound], 128*findLengthfast(&bounceness)); - else FSOUND_SetVolume(channels[whichsound], 32*findLengthfast(&bounceness)); - FSOUND_SetPaused(channels[whichsound], FALSE); - } - }*/ - - //Fix terrain edge collision - /*start=position[i]; - end=tippoint[i]; - whichhit=terrain.lineTerrain(start,end,&colpoint); - if(whichhit!=-1){ - XYZ tippoi,posit; - tippoi=tippoint[i]; - posit=position[i]; - - - while(whichhit!=-1){ - position[i].y+=.1; - tippoint[i].y+=.1; - velocity[i].y+=.1; - tipvelocity[i].y+=.1; - start=position[i]; - end=tippoint[i]; - whichhit=terrain.lineTerrain(start,end,&colpoint); - if(whichhit!=-1) - closestpoint=colpoint*terrain.scale; - } - position[i].y-=.1; - tippoint[i].y-=.1; - velocity[i].y-=.1; - tipvelocity[i].y-=.1; - start=position[i]; - end=tippoint[i]; - whichhit=terrain.lineTerrain(start,end,&colpoint); - while(whichhit!=-1){ - position[i].y+=.01; - tippoint[i].y+=.01; - velocity[i].y+=.01; - tipvelocity[i].y+=.01; - start=position[i]; - end=tippoint[i]; - whichhit=terrain.lineTerrain(start,end,&colpoint); - if(whichhit!=-1) - closestpoint=colpoint*terrain.scale; - } - }*/ - /*if(whichhit!=-1){ - whichhit=terrain.lineTerrain(end,start,&closestswordpoint); - if(whichhit!=-1){ - colpoint=(closestswordpoint*terrain.scale+colpoint*terrain.scale)/2; - proportion=findDistance(&tippoint[i],&colpoint)/findDistance(&position[i],&tippoint[i]); - if(proportion<=1){ - while(whichhit!=-1){ - position[i].y+=.1*proportion; - tippoint[i].y+=.1*(1-proportion); - velocity[i].y+=.1*proportion; - tipvelocity[i].y+=.1*(1-proportion); - start=position[i]; - end=tippoint[i]; - whichhit=terrain.lineTerrain(start,end,&colpoint); - } - position[i].y-=.1*proportion; - tippoint[i].y-=.1*(1-proportion); - velocity[i].y-=.1*proportion; - tipvelocity[i].y-=.1*(1-proportion); - start=position[i]; - end=tippoint[i]; - whichhit=terrain.lineTerrain(start,end,&colpoint); - while(whichhit!=-1){ - position[i].y+=.01*proportion; - tippoint[i].y+=.01*(1-proportion); - velocity[i].y+=.01*proportion; - tipvelocity[i].y+=.01*(1-proportion); - start=position[i]; - end=tippoint[i]; - whichhit=terrain.lineTerrain(start,end,&colpoint); - } - } - } - } - */ //Gravity velocity[i].y+=gravity*multiplier; tipvelocity[i].y+=gravity*multiplier; @@ -1060,7 +752,7 @@ void Weapons::DoStuff(){ } //velocity[i]=(position[i]-oldposition[i])/multiplier; - //tipvelocity[i]==(tippoint[i-+oldtippoint[i])/multiplier; + //tipvelocity[i]==(tippoint[i-+oldtippoint[i])/multiplier; if(freetime[i]>.4){ velocity[i]=0; tipvelocity[i]=0; @@ -1082,8 +774,8 @@ void Weapons::DoStuff(){ bloodloc.y-=.05; if(bloodtoggle){ bloodvel=0; - sprites.MakeSprite(bloodsprite, bloodloc,bloodvel, 1,1,1, .03, 1); - } + Sprite::MakeSprite(bloodsprite, bloodloc,bloodvel, 1,1,1, .03, 1); + } } } if(onfire[i]){ @@ -1101,9 +793,9 @@ void Weapons::DoStuff(){ normalrot.y=1; } } - sprites.MakeSprite(weaponflamesprite, position[i]+tippoint[i]*(((float)abs(Random()%100))/600+.05),normalrot, 1,1,1, (.6+(float)abs(Random()%100)/200-.25)*1/3, 1); - sprites.speed[sprites.numsprites-1]=4; - sprites.alivetime[sprites.numsprites-1]=.3; + Sprite::MakeSprite(weaponflamesprite, position[i]+tippoint[i]*(((float)abs(Random()%100))/600+.05),normalrot, 1,1,1, (.6+(float)abs(Random()%100)/200-.25)*1/3, 1); + Sprite::setLastSpriteSpeed(4); + Sprite::setLastSpriteAlivetime(.3); } } @@ -1116,9 +808,9 @@ void Weapons::DoStuff(){ if(Random()%50==0&&findDistancefast(&position[i],&viewer)>80){ XYZ shinepoint; shinepoint=position[i]+(tippoint[i]-position[i])*(((float)abs(Random()%100))/100); - sprites.MakeSprite(weaponshinesprite, shinepoint,normalrot, 1,1,1, (.1+(float)abs(Random()%100)/200-.25)*1/3*fast_sqrt(findDistance(&shinepoint,&viewer)), 1); - sprites.speed[sprites.numsprites-1]=4; - sprites.alivetime[sprites.numsprites-1]=.3; + Sprite::MakeSprite(weaponshinesprite, shinepoint,normalrot, 1,1,1, (.1+(float)abs(Random()%100)/200-.25)*1/3*fast_sqrt(findDistance(&shinepoint,&viewer)), 1); + Sprite::setLastSpriteSpeed(4); + Sprite::setLastSpriteAlivetime(.3); } } } @@ -1182,8 +874,8 @@ int Weapons::Draw() glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glPushMatrix(); glColor4f(terrainlight.x,terrainlight.y,terrainlight.z,j/drawhowmany[i]); - if(owner[i]!=-1)glTranslatef(position[i].x*(((float)(j))/drawhowmany[i])+lastdrawnposition[i].x*(1-((float)(j))/drawhowmany[i]),position[i].y*(((float)(j))/drawhowmany[i])-.02+lastdrawnposition[i].y*(1-((float)(j))/drawhowmany[i]),position[i].z*(((float)(j))/drawhowmany[i])+lastdrawnposition[i].z*(1-((float)(j))/drawhowmany[i])); - if(owner[i]==-1)glTranslatef(position[i].x*(((float)(j))/drawhowmany[i])+lastdrawnposition[i].x*(1-((float)(j))/drawhowmany[i]),position[i].y*(((float)(j))/drawhowmany[i])+lastdrawnposition[i].y*(1-((float)(j))/drawhowmany[i]),position[i].z*(((float)(j))/drawhowmany[i])+lastdrawnposition[i].z*(1-((float)(j))/drawhowmany[i])); + if(owner[i]!=-1)glTranslatef(position[i].x*(((float)(j))/drawhowmany[i])+lastdrawnposition[i].x*(1-((float)(j))/drawhowmany[i]),position[i].y*(((float)(j))/drawhowmany[i])-.02+lastdrawnposition[i].y*(1-((float)(j))/drawhowmany[i]),position[i].z*(((float)(j))/drawhowmany[i])+lastdrawnposition[i].z*(1-((float)(j))/drawhowmany[i])); + if(owner[i]==-1)glTranslatef(position[i].x*(((float)(j))/drawhowmany[i])+lastdrawnposition[i].x*(1-((float)(j))/drawhowmany[i]),position[i].y*(((float)(j))/drawhowmany[i])+lastdrawnposition[i].y*(1-((float)(j))/drawhowmany[i]),position[i].z*(((float)(j))/drawhowmany[i])+lastdrawnposition[i].z*(1-((float)(j))/drawhowmany[i])); //glTranslatef(position[i].x,position[i].y-.02,position[i].z); glRotatef(bigrotation[i]*(((float)(j))/drawhowmany[i])+lastdrawnbigrotation[i]*(1-((float)(j))/drawhowmany[i]),0,1,0); glRotatef(bigtilt2[i]*(((float)(j))/drawhowmany[i])+lastdrawnbigtilt2[i]*(1-((float)(j))/drawhowmany[i]),1,0,0); @@ -1213,7 +905,7 @@ int Weapons::Draw() if(type[i]==knife) { - glEnable(GL_LIGHTING); + glEnable(GL_LIGHTING); if(!bloody[i]||!bloodtoggle)throwingknifemodel.drawdifftex(knifetextureptr); if(bloodtoggle) { @@ -1223,7 +915,7 @@ int Weapons::Draw() } if(type[i]==sword) { - glEnable(GL_LIGHTING); + glEnable(GL_LIGHTING); if(!bloody[i]||!bloodtoggle)swordmodel.drawdifftex(swordtextureptr); if(bloodtoggle) { @@ -1233,7 +925,7 @@ int Weapons::Draw() } if(type[i]==staff) { - glEnable(GL_LIGHTING); + glEnable(GL_LIGHTING); staffmodel.drawdifftex(stafftextureptr); } @@ -1266,7 +958,7 @@ int Weapons::Draw() glRotatef(-rotation3[i],0,1,0); glRotatef(smallrotation[i],1,0,0); glRotatef(smallrotation2[i],0,1,0); - glTranslatef(0,0,length[i]); + glTranslatef(0,0,length[i]); glGetFloatv(GL_MODELVIEW_MATRIX,M); tippoint[i].x=M[12]; tippoint[i].y=M[13]; @@ -1277,13 +969,13 @@ int Weapons::Draw() XYZ nothingpoint; nothingpoint=0; shinepoint=position[i]; - sprites.MakeSprite(weaponshinesprite, shinepoint,nothingpoint, 1,1,1,multiplier*2, 1); - sprites.speed[sprites.numsprites-1]=4; - sprites.alivetime[sprites.numsprites-1]=.3; + Sprite::MakeSprite(weaponshinesprite, shinepoint,nothingpoint, 1,1,1,multiplier*2, 1); + Sprite::speed[Sprite::numsprites-1]=4; + Sprite::alivetime[Sprite::numsprites-1]=.3; shinepoint=tippoint[i]; - sprites.MakeSprite(weaponshinesprite, shinepoint,nothingpoint, 1,1,1,multiplier*2, 1); - sprites.speed[sprites.numsprites-1]=4; - sprites.alivetime[sprites.numsprites-1]=.3;*/ + Sprite::MakeSprite(weaponshinesprite, shinepoint,nothingpoint, 1,1,1,multiplier*2, 1); + Sprite::speed[Sprite::numsprites-1]=4; + Sprite::alivetime[Sprite::numsprites-1]=.3;*/ } } return 0;