2 Copyright (C) 2003, 2010 - Wolfire Games
4 This file is part of Lugaru.
6 Lugaru is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 See the GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 /**> HEADER FILES <**/
24 #include "openal_wrapper.h"
25 #include "Animation.h"
30 extern float multiplier;
31 extern int channels[100];
32 extern Terrain terrain;
34 extern int environment;
36 extern FRUSTUM frustum;
38 extern float realmultiplier;
40 extern float slomodelay;
41 extern bool cellophane;
42 extern float texdetail;
43 extern GLubyte bloodText[512*512*3];
44 extern int bloodtoggle;
45 extern Objects objects;
47 extern bool autoslomo;
48 extern float camerashake;
50 extern float terraindetail;
51 extern float viewdistance;
52 extern float blackout;
53 extern int difficulty;
55 extern int tutoriallevel;
56 extern int numthrowkill;
58 void Weapons::DoStuff(){
59 static int i,whichpatchx,whichpatchz,j,k,whichhit,m;
60 static XYZ start,end,colpoint,normalrot,footvel,footpoint;
61 static XYZ terrainnormal;
64 static XYZ newpoint1,newpoint2;
65 static float friction=3.5;
66 static float elasticity=.4;
67 static XYZ bounceness;
68 static float frictionness;
69 static float moveamount;
71 static float closestdistance;
72 static float distance;
74 static XYZ closestpoint;
75 static XYZ closestswordpoint;
77 static float proportion;
78 static float tempmult;
82 for(i=0;i<numweapons;i++){
86 if(damage[i]>=2&&type[i]==staff&&owner[i]!=-1){
87 emit_sound_at(staffbreaksound, tippoint[i]);
90 //speed=(tippoint[i]-oldtippoint[i])/multiplier/6;
93 tempvel.x=float(abs(Random()%100)-50)/20;
94 tempvel.y=float(abs(Random()%100)-50)/20;
95 tempvel.z=float(abs(Random()%100)-50)/20;
97 Sprite::MakeSprite(splintersprite, position[i]+(tippoint[i]-position[i])*((float)j-8)/32,tempvel*.5, 115/255,73/255,12/255, .1, 1);
109 player[tempowner].num_weapons--;
110 if(player[tempowner].num_weapons){
111 player[tempowner].weaponids[0]=player[tempowner].weaponids[player[tempowner].num_weapons];
112 if(player[tempowner].weaponstuck==player[tempowner].num_weapons)player[tempowner].weaponstuck=0;
114 player[tempowner].weaponactive=-1;
117 oldposition[i]=position[i];
118 oldtippoint[i]=tippoint[i];
119 if(owner[i]==-1&&(velocity[i].x||velocity[i].y||velocity[i].z)&&!physics[i]){
120 position[i]+=velocity[i]*multiplier;
121 tippoint[i]+=velocity[i]*multiplier;
122 whichpatchx=position[i].x/(terrain.size/subdivision*terrain.scale*terraindetail);
123 whichpatchz=position[i].z/(terrain.size/subdivision*terrain.scale*terraindetail);
124 if(whichpatchx>0&&whichpatchz>0&&whichpatchx<subdivision&&whichpatchz<subdivision)
125 if(terrain.patchobjectnum[whichpatchx][whichpatchz]){
126 for(j=0;j<terrain.patchobjectnum[whichpatchx][whichpatchz];j++){
127 k=terrain.patchobjects[whichpatchx][whichpatchz][j];
128 start=oldtippoint[i];
130 whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
132 if(objects.type[k]==treetrunktype){
133 objects.model[k].MakeDecal(breakdecal,DoRotation(colpoint-objects.position[k],0,-objects.rotation[k],0),.1,1,Random()%360);
134 normalrot=DoRotation(objects.model[k].facenormals[whichhit],0,objects.rotation[k],0);
136 if(type[i]==knife)position[i]=colpoint-normalrot*.1;
137 if(type[i]==sword)position[i]=colpoint-normalrot*.2;
138 if(type[i]==staff)position[i]=colpoint-normalrot*.2;
139 XYZ temppoint1,temppoint2,tempforward;
143 temppoint2=normalrot;
144 distance=findDistance(&temppoint1,&temppoint2);
145 rotation2[i]=asin((temppoint1.y-temppoint2.y)/distance);
146 rotation2[i]*=360/6.28;
149 rotation1[i]=acos((temppoint1.z-temppoint2.z)/findDistance(&temppoint1,&temppoint2));
150 rotation1[i]*=360/6.28;
151 if(temppoint1.x>temppoint2.x)rotation1[i]=360-rotation1[i];
160 emit_sound_at(knifesheathesound, position[i], 128.);
164 Sprite::MakeSprite(cloudimpactsprite, position[i],velocity[i], 1,1,1, .8, .3);
169 position[i]-=velocity[i]*multiplier;
170 tippoint[i]-=velocity[i]*multiplier;
171 tipvelocity[i]=velocity[i];
176 if(velocity[i].x||velocity[i].y||velocity[i].z)
177 for(j=0;j<numplayers;j++){
179 footpoint=DoRotation((player[j].skeleton.joints[player[j].skeleton.jointlabels[abdomen]].position+player[j].skeleton.joints[player[j].skeleton.jointlabels[neck]].position)/2,0,player[j].rotation,0)*player[j].scale+player[j].coords;
180 if(owner[i]==-1&&findDistancefastflat(&position[i],&player[j].coords)<1.5&&findDistancefast(&position[i],&player[j].coords)<4&&player[j].weaponstuck==-1&&!player[j].skeleton.free&&j!=oldowner[i]){
181 if((player[j].aitype!=attacktypecutoff||abs(Random()%6)==0||(player[j].targetanimation!=backhandspringanim&&player[j].targetanimation!=rollanim&&player[j].targetanimation!=flipanim&&Random()%2==0))&&!missed[i]){
183 if((player[j].creature==wolftype&&Random()%3!=0&&player[j].weaponactive==-1&&(player[j].isIdle()||player[j].isRun()||player[j].targetanimation==walkanim))||(player[j].creature==rabbittype&&Random()%2==0&&player[j].aitype==attacktypecutoff&&player[j].weaponactive==-1)){
184 emit_sound_at(knifedrawsound, player[j].coords, 128.);
186 player[j].weaponactive=0;
187 player[j].targetanimation=removeknifeanim;
188 player[j].targetframe=1;
190 owner[i]=player[j].id;
191 if(player[j].num_weapons>0){
192 player[j].weaponids[player[j].num_weapons]=player[j].weaponids[0];
194 player[j].num_weapons++;
195 player[j].weaponids[0]=i;
197 player[j].aitype=attacktypecutoff;
200 if(j!=0)numthrowkill++;
201 player[j].num_weapons++;
202 player[j].weaponstuck=player[j].num_weapons-1;
203 if(normaldotproduct(player[j].facing,velocity[i])>0)player[j].weaponstuckwhere=1;
204 else player[j].weaponstuckwhere=0;
206 player[j].weaponids[player[j].num_weapons-1]=i;
208 player[j].RagDoll(0);
209 player[j].skeleton.joints[player[j].skeleton.jointlabels[abdomen]].velocity+=velocity[i]*2;
210 player[j].skeleton.joints[player[j].skeleton.jointlabels[neck]].velocity+=velocity[i]*2;
211 player[j].skeleton.joints[player[j].skeleton.jointlabels[rightshoulder]].velocity+=velocity[i]*2;
212 player[j].skeleton.joints[player[j].skeleton.jointlabels[leftshoulder]].velocity+=velocity[i]*2;
213 //player[j].Puff(abdomen);
214 if(bloodtoggle&&tutoriallevel!=1)Sprite::MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .8, .3);
215 if(tutoriallevel==1)Sprite::MakeSprite(cloudimpactsprite, footpoint,footvel, 1,1,1, .8, .3);
216 footvel=tippoint[i]-position[i];
218 if(bloodtoggle&&tutoriallevel!=1)Sprite::MakeSprite(bloodflamesprite, footpoint,footvel*-1, 1,0,0, .6, 1);
220 if(tutoriallevel!=1){
221 if(player[j].weaponstuckwhere==0)player[j].DoBloodBig(2,205);
222 if(player[j].weaponstuckwhere==1)player[j].DoBloodBig(2,200);
223 player[j].damage+=200/player[j].armorhigh;
224 player[j].deathbleeding=1;
225 player[j].bloodloss+=(200+abs((float)(Random()%40))-20)/player[j].armorhigh;
231 emit_sound_at(fleshstabsound, position[i], 128.);
233 if(animation[player[0].targetanimation].height==highheight)
234 award_bonus(0, ninja);
236 award_bonus(0, Bullseyebonus);
242 if(position[i].y<terrain.getHeight(position[i].x,position[i].z)){
243 if(terrain.getOpacity(position[i].x,position[i].z)<.2){
245 if(terrain.lineTerrain(oldposition[i],position[i],&colpoint)!=-1){
246 position[i]=colpoint*terrain.scale;
248 else position[i].y=terrain.getHeight(position[i].x,position[i].z);
250 terrain.MakeDecal(shadowdecalpermanent,position[i],.06,.5,0);
251 normalrot=terrain.getNormal(position[i].x,position[i].z)*-1;
253 //position[i]-=normalrot*.1;
254 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
258 glRotatef(bigrotation[i],0,1,0);
259 glRotatef(bigtilt2[i],1,0,0);
260 glRotatef(bigtilt[i],0,0,1);
261 glRotatef(-rotation1[i]+90,0,1,0);
262 glRotatef(-rotation2[i]+90,0,0,1);
263 glRotatef(-rotation3[i],0,1,0);
264 glRotatef(smallrotation[i],1,0,0);
265 glRotatef(smallrotation2[i],0,1,0);
267 glGetFloatv(GL_MODELVIEW_MATRIX,M);
272 position[i]-=tippoint[i]*.15;
273 XYZ temppoint1,temppoint2,tempforward;
283 emit_sound_at(knifesheathesound, position[i], 128.);
286 terrainlight=terrain.getLighting(position[i].x,position[i].z);
287 if(environment==snowyenvironment){
288 if(findDistancefast(&position[i],&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, position[i],velocity[i], terrainlight.x,terrainlight.y,terrainlight.z, .5, .7);
290 else if(environment==grassyenvironment){
291 if(findDistancefast(&position[i],&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, position[i],velocity[i], terrainlight.x*90/255,terrainlight.y*70/255,terrainlight.z*8/255, .5, .5);
293 else if(environment==desertenvironment){
294 if(findDistancefast(&position[i],&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, position[i],velocity[i], terrainlight.x*190/255,terrainlight.y*170/255,terrainlight.z*108/255, .5, .7);
302 position[i]-=velocity[i]*multiplier;
303 tippoint[i]-=velocity[i]*multiplier;
304 tipvelocity[i]=velocity[i];
307 if(velocity[i].x!=0||velocity[i].z!=0||velocity[i].y!=0){
308 velocity[i].y+=gravity*multiplier;
310 XYZ temppoint1,temppoint2,tempforward;
314 temppoint2=velocity[i];
315 distance=findDistance(&temppoint1,&temppoint2);
316 rotation2[i]=asin((temppoint1.y-temppoint2.y)/distance);
317 rotation2[i]*=360/6.28;
320 rotation1[i]=acos((temppoint1.z-temppoint2.z)/findDistance(&temppoint1,&temppoint2));
321 rotation1[i]*=360/6.28;
328 if(temppoint1.x>temppoint2.x)rotation1[i]=360-rotation1[i];
338 for(int l=0;l<10;l++){
339 if(owner[i]==-1&&(velocity[i].x||velocity[i].y||velocity[i].z)&&physics[i]){
341 position[i]+=velocity[i]*multiplier;
342 tippoint[i]+=tipvelocity[i]*multiplier;
345 midp=(position[i]*mass[i]+tippoint[i]*tipmass[i])/(mass[i]+tipmass[i]);
346 vel=tippoint[i]-midp;
348 newpoint1=midp-vel*length[i]*(tipmass[i]/(mass[i]+tipmass[i]));
349 newpoint2=midp+vel*length[i]*(mass[i]/(mass[i]+tipmass[i]));
351 if(freetime[i]>.04)velocity[i]=velocity[i]+(newpoint1-position[i])/multiplier;
352 if(freetime[i]>.04)tipvelocity[i]=tipvelocity[i]+(newpoint2-tippoint[i])/multiplier;
354 position[i]=newpoint1;
355 tippoint[i]=newpoint2;
359 whichpatchx=(position[i].x)/(terrain.size/subdivision*terrain.scale*terraindetail);
360 whichpatchz=(position[i].z)/(terrain.size/subdivision*terrain.scale*terraindetail);
361 if(whichpatchx>0&&whichpatchz>0&&whichpatchx<subdivision&&whichpatchz<subdivision)
362 if(terrain.patchobjectnum[whichpatchx][whichpatchz]){
363 for(j=0;j<terrain.patchobjectnum[whichpatchx][whichpatchz];j++){
364 k=terrain.patchobjects[whichpatchx][whichpatchz][j];
368 start=position[i]-(tippoint[i]-position[i])/5;
369 end=tippoint[i]+(tippoint[i]-position[i])/30;
370 whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
373 diff=(colpoint-tippoint[i]);
377 position[i]+=(colpoint-tippoint[i])+diff*.05;
378 tippoint[i]=colpoint+diff*.05;
379 oldposition[i]=position[i];
380 oldtippoint[i]=tippoint[i];
384 start=tippoint[i]-(position[i]-tippoint[i])/5;
385 end=position[i]+(position[i]-tippoint[i])/30;
386 whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
389 diff=(colpoint-position[i]);
393 tippoint[i]+=(colpoint-position[i])+diff*.05;
394 position[i]=colpoint+diff*.05;
395 oldtippoint[i]=tippoint[i];
396 oldposition[i]=tippoint[i];
401 start=oldposition[i];
403 whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
406 position[i]=colpoint;
407 terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.rotation[k],0)*-1;
408 ReflectVector(&velocity[i],&terrainnormal);
409 position[i]+=terrainnormal*.002;
411 bounceness=terrainnormal*findLength(&velocity[i])*(abs(normaldotproduct(velocity[i],terrainnormal)));
412 if(findLengthfast(&velocity[i])<findLengthfast(&bounceness))bounceness=0;
413 frictionness=abs(normaldotproduct(velocity[i],terrainnormal));
414 velocity[i]-=bounceness;
415 if(1-friction*frictionness>0)velocity[i]*=1-friction*frictionness;
417 velocity[i]+=bounceness*elasticity;
419 if(findLengthfast(&bounceness)>1){
421 if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2);
422 if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4);
423 emit_sound_at(whichsound, position[i], 128*findLengthfast(&bounceness));
426 start=oldtippoint[i];
428 whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
431 tippoint[i]=colpoint;
432 terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.rotation[k],0)*-1;
433 ReflectVector(&tipvelocity[i],&terrainnormal);
434 tippoint[i]+=terrainnormal*.002;
436 bounceness=terrainnormal*findLength(&tipvelocity[i])*(abs(normaldotproduct(tipvelocity[i],terrainnormal)));
437 if(findLengthfast(&tipvelocity[i])<findLengthfast(&bounceness))bounceness=0;
438 frictionness=abs(normaldotproduct(tipvelocity[i],terrainnormal));
439 tipvelocity[i]-=bounceness;
440 if(1-friction*frictionness>0)tipvelocity[i]*=1-friction*frictionness;
441 else tipvelocity[i]=0;
442 tipvelocity[i]+=bounceness*elasticity;
444 if(findLengthfast(&bounceness)>1){
446 if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2);
447 if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4);
448 emit_sound_at(whichsound, position[i], 128*findLengthfast(&bounceness));
452 if((objects.type[k]!=boxtype&&objects.type[k]!=platformtype&&objects.type[k]!=walltype&&objects.type[k]!=weirdtype)||objects.rotation2[k]!=0)
454 mid=(position[i]*(21+(float)m*10)+tippoint[i]*(19-(float)m*10))/40;
456 oldmid=(oldposition[i]*(21+(float)m*10)+oldtippoint[i]*(19-(float)m*10))/40;
460 whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
464 terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.rotation[k],0)*-1;
465 ReflectVector(&velocity[i],&terrainnormal);
467 bounceness=terrainnormal*findLength(&velocity[i])*(abs(normaldotproduct(velocity[i],terrainnormal)));
468 if(findLengthfast(&velocity[i])<findLengthfast(&bounceness))bounceness=0;
469 frictionness=abs(normaldotproduct(velocity[i],terrainnormal));
470 velocity[i]-=bounceness;
471 if(1-friction*frictionness>0)velocity[i]*=1-friction*frictionness;
473 velocity[i]+=bounceness*elasticity;
475 if(findLengthfast(&bounceness)>1){
477 if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2);
478 if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4);
479 emit_sound_at(whichsound, mid, 128*findLengthfast(&bounceness));
481 position[i]+=(mid-oldmid2)*(20/(1+(float)m*10));
484 mid=(position[i]*(19-(float)m*10)+tippoint[i]*(21+(float)m*10))/40;
486 oldmid=(oldposition[i]*(19-(float)m*10)+oldtippoint[i]*(21+(float)m*10))/40;
490 whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
494 terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.rotation[k],0)*-1;
495 ReflectVector(&tipvelocity[i],&terrainnormal);
497 bounceness=terrainnormal*findLength(&tipvelocity[i])*(abs(normaldotproduct(tipvelocity[i],terrainnormal)));
498 if(findLengthfast(&tipvelocity[i])<findLengthfast(&bounceness))bounceness=0;
499 frictionness=abs(normaldotproduct(tipvelocity[i],terrainnormal));
500 tipvelocity[i]-=bounceness;
501 if(1-friction*frictionness>0)tipvelocity[i]*=1-friction*frictionness;
502 else tipvelocity[i]=0;
503 tipvelocity[i]+=bounceness*elasticity;
505 if(findLengthfast(&bounceness)>1){
507 if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2);
508 if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4);
509 emit_sound_at(whichsound, mid, 128*findLengthfast(&bounceness));
511 tippoint[i]+=(mid-oldmid2)*(20/(1+(float)m*10));
518 whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
522 closestswordpoint=colpoint;//(position[i]+tippoint[i])/2;
523 point[0]=DoRotation(objects.model[k].vertex[objects.model[k].Triangles[whichhit].vertex[0]],0,objects.rotation[k],0)+objects.position[k];
524 point[1]=DoRotation(objects.model[k].vertex[objects.model[k].Triangles[whichhit].vertex[1]],0,objects.rotation[k],0)+objects.position[k];
525 point[2]=DoRotation(objects.model[k].vertex[objects.model[k].Triangles[whichhit].vertex[2]],0,objects.rotation[k],0)+objects.position[k];
526 if(DistancePointLine(&closestswordpoint, &point[0], &point[1], &distance,&colpoint ))
527 if(distance<closestdistance||closestdistance==-1){
528 closestpoint=colpoint;
529 closestdistance=distance;
532 if(DistancePointLine(&closestswordpoint, &point[1], &point[2], &distance,&colpoint ))
533 if(distance<closestdistance||closestdistance==-1){
534 closestpoint=colpoint;
535 closestdistance=distance;
538 if(DistancePointLine(&closestswordpoint, &point[2], &point[0], &distance,&colpoint ))
539 if(distance<closestdistance||closestdistance==-1){
540 closestpoint=colpoint;
541 closestdistance=distance;
544 if(closestdistance!=-1&&isnormal(closestdistance)){
545 if(DistancePointLine(&closestpoint, &position[i], &tippoint[i], &distance,&colpoint )){
546 closestswordpoint=colpoint;
547 velocity[i]+=(closestpoint-closestswordpoint);
548 tipvelocity[i]+=(closestpoint-closestswordpoint);
549 position[i]+=(closestpoint-closestswordpoint);
550 tippoint[i]+=(closestpoint-closestswordpoint);
559 whichhit=terrain.lineTerrain(oldposition[i],position[i],&colpoint);
560 if(whichhit!=-1||position[i].y<terrain.getHeight(position[i].x,position[i].z)){
562 if(whichhit!=-1)position[i]=colpoint*terrain.scale;
563 else position[i].y=terrain.getHeight(position[i].x,position[i].z);
565 terrainnormal=terrain.getNormal(position[i].x,position[i].z);
566 ReflectVector(&velocity[i],&terrainnormal);
567 position[i]+=terrainnormal*.002;
568 bounceness=terrainnormal*findLength(&velocity[i])*(abs(normaldotproduct(velocity[i],terrainnormal)));
569 if(findLengthfast(&velocity[i])<findLengthfast(&bounceness))bounceness=0;
570 frictionness=abs(normaldotproduct(velocity[i],terrainnormal));
571 velocity[i]-=bounceness;
572 if(1-friction*frictionness>0)velocity[i]*=1-friction*frictionness;
574 if(terrain.getOpacity(position[i].x,position[i].z)<.2)velocity[i]+=bounceness*elasticity*.3;
575 else velocity[i]+=bounceness*elasticity;
576 //if (type[i]==knife) printf("velocity of knife %d now %f,%f,%f.\n", i, velocity[i].x, velocity[i].y, velocity[i].z);
577 if(findLengthfast(&bounceness)>1){
579 if(terrain.getOpacity(position[i].x,position[i].z)>.2){
580 if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2);
581 if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4);
583 else whichsound=footstepsound+abs(Random()%2);
584 emit_sound_at(whichsound, position[i],
585 findLengthfast(&bounceness)
586 * (terrain.getOpacity(position[i].x,position[i].z) > .2
590 if(terrain.getOpacity(position[i].x,position[i].z)<.2){
592 terrainlight=terrain.getLighting(position[i].x,position[i].z);
593 if(environment==snowyenvironment){
594 if(findDistancefast(&position[i],&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, position[i],velocity[i], terrainlight.x,terrainlight.y,terrainlight.z, .5, .7);
596 else if(environment==grassyenvironment){
597 if(findDistancefast(&position[i],&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, position[i],velocity[i], terrainlight.x*90/255,terrainlight.y*70/255,terrainlight.z*8/255, .5, .5);
599 else if(environment==desertenvironment){
600 if(findDistancefast(&position[i],&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, position[i],velocity[i], terrainlight.x*190/255,terrainlight.y*170/255,terrainlight.z*108/255, .5, .7);
605 whichhit=terrain.lineTerrain(oldtippoint[i],tippoint[i],&colpoint);
606 if(whichhit!=-1||tippoint[i].y<terrain.getHeight(tippoint[i].x,tippoint[i].z)){
607 if(whichhit!=-1)tippoint[i]=colpoint*terrain.scale;
608 else tippoint[i].y=terrain.getHeight(tippoint[i].x,tippoint[i].z);
610 terrainnormal=terrain.getNormal(tippoint[i].x,tippoint[i].z);
611 ReflectVector(&tipvelocity[i],&terrainnormal);
612 tippoint[i]+=terrainnormal*.002;
613 bounceness=terrainnormal*findLength(&tipvelocity[i])*(abs(normaldotproduct(tipvelocity[i],terrainnormal)));
614 if(findLengthfast(&tipvelocity[i])<findLengthfast(&bounceness))bounceness=0;
615 frictionness=abs(normaldotproduct(tipvelocity[i],terrainnormal));
616 tipvelocity[i]-=bounceness;
617 if(1-friction*frictionness>0)tipvelocity[i]*=1-friction*frictionness;
618 else tipvelocity[i]=0;
619 if(terrain.getOpacity(tippoint[i].x,tippoint[i].z)<.2)tipvelocity[i]+=bounceness*elasticity*.3;
620 else tipvelocity[i]+=bounceness*elasticity;
621 //if (type[i]==knife) printf("tipvelocity of knife %d now %f,%f,%f.\n", i, tipvelocity[i].x, tipvelocity[i].y, tipvelocity[i].z);
623 if(findLengthfast(&bounceness)>1){
625 if(terrain.getOpacity(tippoint[i].x,tippoint[i].z)>.2){
626 if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2);
627 if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4);
629 else whichsound=footstepsound+abs(Random()%2);
630 emit_sound_at(whichsound, tippoint[i],
631 findLengthfast(&bounceness)
632 * (terrain.getOpacity(tippoint[i].x,tippoint[i].z) > .2
636 if(terrain.getOpacity(tippoint[i].x,tippoint[i].z)<.2){
638 terrainlight=terrain.getLighting(tippoint[i].x,tippoint[i].z);
639 if(environment==snowyenvironment){
640 if(findDistancefast(&tippoint[i],&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, tippoint[i],tipvelocity[i], terrainlight.x,terrainlight.y,terrainlight.z, .5, .7);
642 else if(environment==grassyenvironment){
643 if(findDistancefast(&tippoint[i],&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, tippoint[i],tipvelocity[i], terrainlight.x*90/255,terrainlight.y*70/255,terrainlight.z*8/255, .5, .5);
645 else if(environment==desertenvironment){
646 if(findDistancefast(&tippoint[i],&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, tippoint[i],tipvelocity[i], terrainlight.x*190/255,terrainlight.y*170/255,terrainlight.z*108/255, .5, .7);
653 mid=position[i]+tippoint[i];
655 mid+=(position[i]-mid)/20;
657 if(mid.y<terrain.getHeight(mid.x,mid.z)){
659 mid.y=terrain.getHeight(mid.x,mid.z);
661 terrainnormal=terrain.getNormal(mid.x,mid.z);
662 ReflectVector(&velocity[i],&terrainnormal);
663 //mid+=terrainnormal*.002;
664 bounceness=terrainnormal*findLength(&velocity[i])*(abs(normaldotproduct(velocity[i],terrainnormal)));
665 if(findLengthfast(&velocity[i])<findLengthfast(&bounceness))bounceness=0;
666 frictionness=abs(normaldotproduct(velocity[i],terrainnormal));
667 velocity[i]-=bounceness;
668 if(1-friction*frictionness>0)velocity[i]*=1-friction*frictionness;
670 if(terrain.getOpacity(mid.x,mid.z)<.2)velocity[i]+=bounceness*elasticity*.3;
671 else velocity[i]+=bounceness*elasticity;
673 if(findLengthfast(&bounceness)>1){
675 if(terrain.getOpacity(mid.x,mid.z)>.2){
676 if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2);
677 if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4);
679 else whichsound=footstepsound+abs(Random()%2);
680 emit_sound_at(whichsound, mid,
681 findLengthfast(&bounceness)
682 * (terrain.getOpacity(position[i].x,position[i].z) > .2
686 position[i]+=(mid-oldmid)*20;
689 mid=position[i]+tippoint[i];
691 mid+=(tippoint[i]-mid)/20;
693 if(mid.y<terrain.getHeight(mid.x,mid.z)){
695 mid.y=terrain.getHeight(mid.x,mid.z);
697 terrainnormal=terrain.getNormal(mid.x,mid.z);
698 ReflectVector(&tipvelocity[i],&terrainnormal);
699 //mid+=terrainnormal*.002;
700 bounceness=terrainnormal*findLength(&tipvelocity[i])*(abs(normaldotproduct(tipvelocity[i],terrainnormal)));
701 if(findLengthfast(&tipvelocity[i])<findLengthfast(&bounceness))bounceness=0;
702 frictionness=abs(normaldotproduct(tipvelocity[i],terrainnormal));
703 tipvelocity[i]-=bounceness;
704 if(1-friction*frictionness>0)tipvelocity[i]*=1-friction*frictionness;
705 else tipvelocity[i]=0;
706 if(terrain.getOpacity(mid.x,mid.z)<.2)tipvelocity[i]+=bounceness*elasticity*.3;
707 else tipvelocity[i]+=bounceness*elasticity;
709 if(findLengthfast(&bounceness)>1){
711 if(terrain.getOpacity(mid.x,mid.z)>.2){
712 if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2);
713 if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4);
715 else whichsound=footstepsound+abs(Random()%2);
716 emit_sound_at(whichsound, mid,
717 findLengthfast(&bounceness)
718 * (terrain.getOpacity(position[i].x,position[i].z) > .2
722 tippoint[i]+=(mid-oldmid)*20;
725 mid=position[i]+tippoint[i];
727 if(position[i].y<terrain.getHeightExtrude(mid.x,mid.z,position[i].x,position[i].z)){
729 position[i].y=terrain.getHeightExtrude(mid.x,mid.z,position[i].x,position[i].z);
731 terrainnormal=terrain.getNormal(mid.x,mid.z);
732 ReflectVector(&velocity[i],&terrainnormal);
733 position[i]+=terrainnormal*.002;
734 bounceness=terrainnormal*findLength(&velocity[i])*(abs(normaldotproduct(velocity[i],terrainnormal)));
735 if(findLengthfast(&velocity[i])<findLengthfast(&bounceness))bounceness=0;
736 frictionness=abs(normaldotproduct(velocity[i],terrainnormal));
737 velocity[i]-=bounceness;
738 if(1-friction*frictionness>0)velocity[i]*=1-friction*frictionness;
740 if(terrain.getOpacity(mid.x,mid.z)<.2)velocity[i]+=bounceness*elasticity*.3;
741 else velocity[i]+=bounceness*elasticity;
743 if(findLengthfast(&bounceness)>1){
747 if(terrain.getOpacity(mid.x,mid.z)>.2){
748 if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2);
749 if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4);
751 else whichsound=footstepsound+abs(Random()%2);
752 gLoc[0]=position[i].x;
753 gLoc[1]=position[i].y;
754 gLoc[2]=position[i].z;
758 PlaySoundEx( whichsound, samp[whichsound], NULL, true);
759 OPENAL_3D_SetAttributes(channels[whichsound], gLoc, vel);
760 if(terrain.getOpacity(position[i].x,position[i].z)>.2)OPENAL_SetVolume(channels[whichsound], 128*findLengthfast(&bounceness));
761 else OPENAL_SetVolume(channels[whichsound], 32*findLengthfast(&bounceness));
762 OPENAL_SetPaused(channels[whichsound], false);
766 if(tippoint[i].y<terrain.getHeightExtrude(mid.x,mid.z,tippoint[i].x,tippoint[i].z)){
768 tippoint[i].y=terrain.getHeightExtrude(mid.x,mid.z,tippoint[i].x,tippoint[i].z);
770 terrainnormal=terrain.getNormal(mid.x,mid.z);
771 ReflectVector(&tipvelocity[i],&terrainnormal);
772 tippoint[i]+=terrainnormal*.002;
773 bounceness=terrainnormal*findLength(&tipvelocity[i])*(abs(normaldotproduct(tipvelocity[i],terrainnormal)));
774 if(findLengthfast(&tipvelocity[i])<findLengthfast(&bounceness))bounceness=0;
775 frictionness=abs(normaldotproduct(tipvelocity[i],terrainnormal));
776 tipvelocity[i]-=bounceness;
777 if(1-friction*frictionness>0)tipvelocity[i]*=1-friction*frictionness;
778 else tipvelocity[i]=0;
779 if(terrain.getOpacity(mid.x,mid.z)<.2)tipvelocity[i]+=bounceness*elasticity*.3;
780 else tipvelocity[i]+=bounceness*elasticity;
782 if(findLengthfast(&bounceness)>1){
786 if(terrain.getOpacity(mid.x,mid.z)>.2){
787 if(type[i]==staff)whichsound=footstepsound3+abs(Random()%2);
788 if(type[i]!=staff)whichsound=clank1sound+abs(Random()%4);
790 else whichsound=footstepsound+abs(Random()%2);
791 gLoc[0]=tippoint[i].x;
792 gLoc[1]=tippoint[i].y;
793 gLoc[2]=tippoint[i].z;
797 PlaySoundEx( whichsound, samp[whichsound], NULL, true);
798 OPENAL_3D_SetAttributes(channels[whichsound], gLoc, vel);
799 if(terrain.getOpacity(tippoint[i].x,tippoint[i].z)>.2)OPENAL_SetVolume(channels[whichsound], 128*findLengthfast(&bounceness));
800 else OPENAL_SetVolume(channels[whichsound], 32*findLengthfast(&bounceness));
801 OPENAL_SetPaused(channels[whichsound], false);
805 //Fix terrain edge collision
808 whichhit=terrain.lineTerrain(start,end,&colpoint);
819 tipvelocity[i].y+=.1;
822 whichhit=terrain.lineTerrain(start,end,&colpoint);
824 closestpoint=colpoint*terrain.scale;
829 tipvelocity[i].y-=.1;
832 whichhit=terrain.lineTerrain(start,end,&colpoint);
837 tipvelocity[i].y+=.01;
840 whichhit=terrain.lineTerrain(start,end,&colpoint);
842 closestpoint=colpoint*terrain.scale;
846 whichhit=terrain.lineTerrain(end,start,&closestswordpoint);
848 colpoint=(closestswordpoint*terrain.scale+colpoint*terrain.scale)/2;
849 proportion=findDistance(&tippoint[i],&colpoint)/findDistance(&position[i],&tippoint[i]);
852 position[i].y+=.1*proportion;
853 tippoint[i].y+=.1*(1-proportion);
854 velocity[i].y+=.1*proportion;
855 tipvelocity[i].y+=.1*(1-proportion);
858 whichhit=terrain.lineTerrain(start,end,&colpoint);
860 position[i].y-=.1*proportion;
861 tippoint[i].y-=.1*(1-proportion);
862 velocity[i].y-=.1*proportion;
863 tipvelocity[i].y-=.1*(1-proportion);
866 whichhit=terrain.lineTerrain(start,end,&colpoint);
868 position[i].y+=.01*proportion;
869 tippoint[i].y+=.01*(1-proportion);
870 velocity[i].y+=.01*proportion;
871 tipvelocity[i].y+=.01*(1-proportion);
874 whichhit=terrain.lineTerrain(start,end,&colpoint);
881 velocity[i].y+=gravity*multiplier;
882 tipvelocity[i].y+=gravity*multiplier;
883 //position[i].y+=gravity*multiplier*multiplier;
884 //tippoint[i].y+=gravity*multiplier*multiplier;
887 XYZ temppoint1,temppoint2,tempforward;
890 temppoint1=position[i];
891 temppoint2=tippoint[i];
892 distance=findDistance(&temppoint1,&temppoint2);
893 rotation2[i]=asin((temppoint1.y-temppoint2.y)/distance);
894 rotation2[i]*=360/6.28;
897 rotation1[i]=acos((temppoint1.z-temppoint2.z)/findDistance(&temppoint1,&temppoint2));
898 rotation1[i]*=360/6.28;
905 if(temppoint1.x>temppoint2.x)rotation1[i]=360-rotation1[i];
908 if(findLengthfast(&velocity[i])<.3&&findLengthfast(&tipvelocity[i])<.3&&hitsomething[i]){
909 freetime[i]+=multiplier;
912 //velocity[i]=(position[i]-oldposition[i])/multiplier;
913 //tipvelocity[i]==(tippoint[i-+oldtippoint[i])/multiplier;
922 if(blooddrip[i]&&bloody[i]){
923 blooddripdelay[i]-=blooddrip[i]*multiplier/2;
924 blooddrip[i]-=multiplier;
925 if(blooddrip[i]<0)blooddrip[i]=0;
926 if(blooddrip[i]>5)blooddrip[i]=5;
927 if(blooddripdelay[i]<0&&bloodtoggle){
931 bloodloc=position[i]+(tippoint[i]-position[i])*.7;
935 Sprite::MakeSprite(bloodsprite, bloodloc,bloodvel, 1,1,1, .03, 1);
940 flamedelay[i]-=multiplier;
941 if(onfire[i]&&flamedelay[i]<=0){
943 flamedelay[i]-=multiplier;
946 normalrot=player[owner[i]].velocity;
950 if(player[owner[i]].onterrain){
954 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);
955 Sprite::setLastSpriteSpeed(4);
956 Sprite::setLastSpriteAlivetime(.3);
960 if(!onfire[i]&&owner[i]==-1&&type[i]!=staff){
961 flamedelay[i]-=multiplier;
962 if(flamedelay[i]<=0){
964 flamedelay[i]-=multiplier;
966 if(Random()%50==0&&findDistancefast(&position[i],&viewer)>80){
968 shinepoint=position[i]+(tippoint[i]-position[i])*(((float)abs(Random()%100))/100);
969 Sprite::MakeSprite(weaponshinesprite, shinepoint,normalrot, 1,1,1, (.1+(float)abs(Random()%100)/200-.25)*1/3*fast_sqrt(findDistance(&shinepoint,&viewer)), 1);
970 Sprite::setLastSpriteSpeed(4);
971 Sprite::setLastSpriteAlivetime(.3);
981 static XYZ terrainlight;
982 static GLfloat M[16];
984 glAlphaFunc(GL_GREATER, 0.9);
985 glEnable(GL_TEXTURE_2D);
987 glEnable(GL_CULL_FACE);
988 glCullFace(GL_FRONT);
990 for(i=0;i<numweapons;i++)
992 if((frustum.SphereInFrustum(position[i].x,position[i].y,position[i].z,1)&&findDistancefast(&viewer,&position[i])<viewdistance*viewdistance))
998 if(velocity[i].x&&!physics[i])drawhowmany[i]=10;
999 else drawhowmany[i]=1;
1003 if(player[owner[i]].occluded<25)
1004 if((frustum.SphereInFrustum(player[owner[i]].coords.x,player[owner[i]].coords.y+player[owner[i]].scale*3,player[owner[i]].coords.z,player[owner[i]].scale*8)&&findDistancefast(&viewer,&player[owner[i]].coords)<viewdistance*viewdistance)||player[owner[i]].skeleton.free==3)
1006 if((player[owner[i]].targetanimation==knifeslashstartanim||player[owner[i]].targetanimation==swordsneakattackanim||(player[owner[i]].currentanimation==staffhitanim&&player[owner[i]].currentframe>1)||(player[owner[i]].currentanimation==staffhitreversedanim&&player[owner[i]].currentframe>1)||(player[owner[i]].currentanimation==staffspinhitanim&&player[owner[i]].currentframe>1)||(player[owner[i]].currentanimation==staffspinhitreversedanim&&player[owner[i]].currentframe>1)||(player[owner[i]].currentanimation==staffgroundsmashanim&&player[owner[i]].currentframe>1)||(player[owner[i]].targetanimation==swordslashanim&&player[owner[i]].targetframe<7)||player[owner[i]].targetanimation==crouchstabanim||player[owner[i]].targetanimation==swordslashreversalanim||player[owner[i]].targetanimation==swordslashreversedanim||player[owner[i]].targetanimation==knifefollowanim||player[owner[i]].targetanimation==swordgroundstabanim||player[owner[i]].targetanimation==knifethrowanim)&&player[owner[i]].targetanimation==lastdrawnanim[i]&&!player[owner[i]].skeleton.free)
1010 else drawhowmany[i]=1;
1011 if(player[owner[i]].targetanimation==swordgroundstabanim)
1013 lastdrawnrotation1[i]=rotation1[i];
1014 lastdrawnrotation2[i]=rotation2[i];
1015 lastdrawnrotation3[i]=rotation3[i];
1016 lastdrawnbigrotation[i]=bigrotation[i];
1017 lastdrawnbigtilt[i]=bigtilt[i];
1018 lastdrawnbigtilt2[i]=bigtilt2[i];
1019 lastdrawnsmallrotation[i]=smallrotation[i];
1020 lastdrawnsmallrotation2[i]=smallrotation2[i];
1025 terrainlight=terrain.getLighting(position[i].x,position[i].z);
1026 if(drawhowmany[i]>0)
1028 glAlphaFunc(GL_GREATER, 0.01);
1030 for(j=drawhowmany[i];j>0;j--)
1032 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1034 glColor4f(terrainlight.x,terrainlight.y,terrainlight.z,j/drawhowmany[i]);
1035 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]));
1036 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]));
1037 //glTranslatef(position[i].x,position[i].y-.02,position[i].z);
1038 glRotatef(bigrotation[i]*(((float)(j))/drawhowmany[i])+lastdrawnbigrotation[i]*(1-((float)(j))/drawhowmany[i]),0,1,0);
1039 glRotatef(bigtilt2[i]*(((float)(j))/drawhowmany[i])+lastdrawnbigtilt2[i]*(1-((float)(j))/drawhowmany[i]),1,0,0);
1040 glRotatef(bigtilt[i]*(((float)(j))/drawhowmany[i])+lastdrawnbigtilt[i]*(1-((float)(j))/drawhowmany[i]),0,0,1);
1041 glRotatef(-rotation1[i]*(((float)(j))/drawhowmany[i])-lastdrawnrotation1[i]*(1-((float)(j))/drawhowmany[i])+90,0,1,0);
1042 glRotatef(-rotation2[i]*(((float)(j))/drawhowmany[i])-lastdrawnrotation2[i]*(1-((float)(j))/drawhowmany[i])+90,0,0,1);
1043 glRotatef(-rotation3[i]*(((float)(j))/drawhowmany[i])-lastdrawnrotation3[i]*(1-((float)(j))/drawhowmany[i]),0,1,0);
1044 glRotatef(smallrotation[i]*(((float)(j))/drawhowmany[i])+lastdrawnsmallrotation[i]*(1-((float)(j))/drawhowmany[i]),1,0,0);
1045 glRotatef(smallrotation2[i]*(((float)(j))/drawhowmany[i])+lastdrawnsmallrotation2[i]*(1-((float)(j))/drawhowmany[i]),0,1,0);
1049 if(player[owner[i]].targetanimation==staffhitanim||player[owner[i]].currentanimation==staffhitanim||player[owner[i]].targetanimation==staffhitreversedanim||player[owner[i]].currentanimation==staffhitreversedanim)
1051 glTranslatef(0,0,-.3);
1053 if(player[owner[i]].targetanimation==staffgroundsmashanim||player[owner[i]].currentanimation==staffgroundsmashanim||player[owner[i]].targetanimation==staffspinhitreversedanim||player[owner[i]].currentanimation==staffspinhitreversedanim||player[owner[i]].targetanimation==staffspinhitanim||player[owner[i]].currentanimation==staffspinhitanim)
1055 glTranslatef(0,0,-.1);
1058 /*if(type[i]==knife){
1060 if(!physics[i]&&findDistance(&position[i],&oldposition[i])*5>1)glScalef(1,1,findDistance(&position[i],&oldposition[i])*5);
1066 glEnable(GL_LIGHTING);
1067 if(!bloody[i]||!bloodtoggle)throwingknifemodel.drawdifftex(knifetextureptr);
1070 if(bloody[i]==1)throwingknifemodel.drawdifftex(lightbloodknifetextureptr);
1071 if(bloody[i]==2)throwingknifemodel.drawdifftex(bloodknifetextureptr);
1076 glEnable(GL_LIGHTING);
1077 if(!bloody[i]||!bloodtoggle)swordmodel.drawdifftex(swordtextureptr);
1080 if(bloody[i]==1)swordmodel.drawdifftex(lightbloodswordtextureptr);
1081 if(bloody[i]==2)swordmodel.drawdifftex(bloodswordtextureptr);
1086 glEnable(GL_LIGHTING);
1087 staffmodel.drawdifftex(stafftextureptr);
1093 lastdrawnposition[i]=position[i];
1094 lastdrawntippoint[i]=tippoint[i];
1095 lastdrawnrotation1[i]=rotation1[i];
1096 lastdrawnrotation2[i]=rotation2[i];
1097 lastdrawnrotation3[i]=rotation3[i];
1098 lastdrawnbigrotation[i]=bigrotation[i];
1099 lastdrawnbigtilt[i]=bigtilt[i];
1100 lastdrawnbigtilt2[i]=bigtilt2[i];
1101 lastdrawnsmallrotation[i]=smallrotation[i];
1102 lastdrawnsmallrotation2[i]=smallrotation2[i];
1103 if(owner[i]!=-1)lastdrawnanim[i]=player[owner[i]].currentanimation;
1107 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1110 glTranslatef(position[i].x,position[i].y-.02,position[i].z);
1111 glRotatef(bigrotation[i],0,1,0);
1112 glRotatef(bigtilt2[i],1,0,0);
1113 glRotatef(bigtilt[i],0,0,1);
1114 glRotatef(-rotation1[i]+90,0,1,0);
1115 glRotatef(-rotation2[i]+90,0,0,1);
1116 glRotatef(-rotation3[i],0,1,0);
1117 glRotatef(smallrotation[i],1,0,0);
1118 glRotatef(smallrotation2[i],0,1,0);
1119 glTranslatef(0,0,length[i]);
1120 glGetFloatv(GL_MODELVIEW_MATRIX,M);
1121 tippoint[i].x=M[12];
1122 tippoint[i].y=M[13];
1123 tippoint[i].z=M[14];
1129 shinepoint=position[i];
1130 Sprite::MakeSprite(weaponshinesprite, shinepoint,nothingpoint, 1,1,1,multiplier*2, 1);
1131 Sprite::speed[Sprite::numsprites-1]=4;
1132 Sprite::alivetime[Sprite::numsprites-1]=.3;
1133 shinepoint=tippoint[i];
1134 Sprite::MakeSprite(weaponshinesprite, shinepoint,nothingpoint, 1,1,1,multiplier*2, 1);
1135 Sprite::speed[Sprite::numsprites-1]=4;
1136 Sprite::alivetime[Sprite::numsprites-1]=.3;*/
1146 // Model throwingknifemodel;
1147 knifetextureptr = 0;
1148 lightbloodknifetextureptr = 0;
1149 bloodknifetextureptr = 0;
1151 // Model swordmodel;
1152 swordtextureptr = 0;
1153 lightbloodswordtextureptr = 0;
1154 bloodswordtextureptr = 0;
1156 // Model staffmodel;
1157 stafftextureptr = 0;
1162 if (stafftextureptr) glDeleteTextures( 1, &stafftextureptr );
1163 if (knifetextureptr) glDeleteTextures( 1, &knifetextureptr );
1164 if (lightbloodknifetextureptr) glDeleteTextures( 1, &lightbloodknifetextureptr );
1165 if (bloodknifetextureptr) glDeleteTextures( 1, &bloodknifetextureptr );
1166 if (swordtextureptr) glDeleteTextures( 1, &swordtextureptr );
1167 if (lightbloodswordtextureptr) glDeleteTextures( 1, &lightbloodswordtextureptr );
1168 if (bloodswordtextureptr) glDeleteTextures( 1, &bloodswordtextureptr );