X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FWeapons.cpp;h=0346e57da74276347263ff297410b55cce4c154b;hb=8557e339c9a2d10afdf6465e02eca6b87efc961f;hp=4d8f32ec7cddf536780d416e701cdadd3df2986d;hpb=263a338c0c3648cfa2388d4a21584a09294ffd9e;p=lugaru.git diff --git a/Source/Weapons.cpp b/Source/Weapons.cpp index 4d8f32e..0346e57 100644 --- a/Source/Weapons.cpp +++ b/Source/Weapons.cpp @@ -54,17 +54,17 @@ extern int tutoriallevel; extern int numthrowkill; Model Weapon::throwingknifemodel; -GLuint Weapon::knifetextureptr = 0; -GLuint Weapon::lightbloodknifetextureptr = 0; -GLuint Weapon::bloodknifetextureptr = 0; +Texture Weapon::knifetextureptr; +Texture Weapon::lightbloodknifetextureptr; +Texture Weapon::bloodknifetextureptr; Model Weapon::swordmodel; -GLuint Weapon::swordtextureptr = 0; -GLuint Weapon::lightbloodswordtextureptr = 0; -GLuint Weapon::bloodswordtextureptr = 0; +Texture Weapon::swordtextureptr; +Texture Weapon::lightbloodswordtextureptr; +Texture Weapon::bloodswordtextureptr; Model Weapon::staffmodel; -GLuint Weapon::stafftextureptr = 0; +Texture Weapon::stafftextureptr; Weapon::Weapon(int t, int o) : owner(o) { setType(t); @@ -214,18 +214,18 @@ void Weapon::DoStuff(int i) { if(velocity.x||velocity.y||velocity.z) { for(int j=0;j0){ @@ -248,10 +248,10 @@ void Weapon::DoStuff(int i) { player[j].weaponids[player[j].num_weapons-1]=i; player[j].RagDoll(0); - player[j].skeleton.joints[player[j].skeleton.jointlabels[abdomen]].velocity+=velocity*2; - player[j].skeleton.joints[player[j].skeleton.jointlabels[neck]].velocity+=velocity*2; - player[j].skeleton.joints[player[j].skeleton.jointlabels[rightshoulder]].velocity+=velocity*2; - player[j].skeleton.joints[player[j].skeleton.jointlabels[leftshoulder]].velocity+=velocity*2; + player[j].jointVel(abdomen)+=velocity*2; + player[j].jointVel(neck)+=velocity*2; + player[j].jointVel(rightshoulder)+=velocity*2; + player[j].jointVel(leftshoulder)+=velocity*2; if(bloodtoggle&&tutoriallevel!=1) Sprite::MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .8, .3); if(tutoriallevel==1) @@ -276,7 +276,7 @@ void Weapon::DoStuff(int i) { emit_sound_at(fleshstabsound, position, 128.); - if(animation[player[0].targetanimation].height==highheight) + if(animation[player[0].animTarget].height==highheight) award_bonus(0, ninja); else award_bonus(0, Bullseyebonus); @@ -331,15 +331,15 @@ void Weapon::DoStuff(int i) { XYZ terrainlight; terrainlight=terrain.getLighting(position.x,position.z); if(environment==snowyenvironment){ - if(findDistancefast(&position,&viewer)80) { + if(Random()%50==0&&distsq(&position,&viewer)>80) { XYZ shinepoint; shinepoint=position+(tippoint-position)*(((float)abs(Random()%100))/100); Sprite::MakeSprite(weaponshinesprite, shinepoint,normalrot, 1,1,1, (.1+(float)abs(Random()%100)/200-.25)*1/3*fast_sqrt(findDistance(&shinepoint,&viewer)), 1); @@ -898,7 +898,7 @@ void Weapon::Draw() { static GLfloat M[16]; if((frustum.SphereInFrustum(position.x,position.y,position.z,1)&& - findDistancefast(&viewer,&position)1)|| - (player[owner].currentanimation==staffhitreversedanim && player[owner].currentframe>1)|| - (player[owner].currentanimation==staffspinhitanim && player[owner].currentframe>1)|| - (player[owner].currentanimation==staffspinhitreversedanim && player[owner].currentframe>1)|| - (player[owner].currentanimation==staffgroundsmashanim && player[owner].currentframe>1)|| - (player[owner].targetanimation==swordslashanim && player[owner].targetframe<7)|| - player[owner].targetanimation==crouchstabanim|| - player[owner].targetanimation==swordslashreversalanim|| - player[owner].targetanimation==swordslashreversedanim|| - player[owner].targetanimation==knifefollowanim|| - player[owner].targetanimation==swordgroundstabanim|| - player[owner].targetanimation==knifethrowanim)&& - player[owner].targetanimation==lastdrawnanim&& + (player[owner].animTarget==knifeslashstartanim|| + player[owner].animTarget==swordsneakattackanim|| + (player[owner].animCurrent==staffhitanim && player[owner].frameCurrent>1)|| + (player[owner].animCurrent==staffhitreversedanim && player[owner].frameCurrent>1)|| + (player[owner].animCurrent==staffspinhitanim && player[owner].frameCurrent>1)|| + (player[owner].animCurrent==staffspinhitreversedanim && player[owner].frameCurrent>1)|| + (player[owner].animCurrent==staffgroundsmashanim && player[owner].frameCurrent>1)|| + (player[owner].animTarget==swordslashanim && player[owner].frameTarget<7)|| + player[owner].animTarget==crouchstabanim|| + player[owner].animTarget==swordslashreversalanim|| + player[owner].animTarget==swordslashreversedanim|| + player[owner].animTarget==knifefollowanim|| + player[owner].animTarget==swordgroundstabanim|| + player[owner].animTarget==knifethrowanim)&& + player[owner].animTarget==lastdrawnanim&& !player[owner].skeleton.free ) { @@ -935,7 +935,7 @@ void Weapon::Draw() { } else { drawhowmany=1; } - if(player[owner].targetanimation==swordgroundstabanim) + if(player[owner].animTarget==swordgroundstabanim) { lastdrawnrotation1=rotation1; lastdrawnrotation2=rotation2; @@ -974,11 +974,11 @@ void Weapon::Draw() { if(owner!=-1) { - if(player[owner].targetanimation==staffhitanim||player[owner].currentanimation==staffhitanim||player[owner].targetanimation==staffhitreversedanim||player[owner].currentanimation==staffhitreversedanim) + if(player[owner].animTarget==staffhitanim||player[owner].animCurrent==staffhitanim||player[owner].animTarget==staffhitreversedanim||player[owner].animCurrent==staffhitreversedanim) { glTranslatef(0,0,-.3); } - if(player[owner].targetanimation==staffgroundsmashanim||player[owner].currentanimation==staffgroundsmashanim||player[owner].targetanimation==staffspinhitreversedanim||player[owner].currentanimation==staffspinhitreversedanim||player[owner].targetanimation==staffspinhitanim||player[owner].currentanimation==staffspinhitanim) + if(player[owner].animTarget==staffgroundsmashanim||player[owner].animCurrent==staffgroundsmashanim||player[owner].animTarget==staffspinhitreversedanim||player[owner].animCurrent==staffspinhitreversedanim||player[owner].animTarget==staffspinhitanim||player[owner].animCurrent==staffspinhitanim) { glTranslatef(0,0,-.1); } @@ -1026,7 +1026,7 @@ void Weapon::Draw() { lastdrawnbigtilt2=bigtilt2; lastdrawnsmallrotation=smallrotation; lastdrawnsmallrotation2=smallrotation2; - if(owner!=-1)lastdrawnanim=player[owner].currentanimation; + if(owner!=-1)lastdrawnanim=player[owner].animCurrent; } if(owner!=-1) { @@ -1073,12 +1073,12 @@ Weapons::Weapons() Weapons::~Weapons() { - glDeleteTextures( 1, &Weapon::stafftextureptr ); - glDeleteTextures( 1, &Weapon::knifetextureptr ); - glDeleteTextures( 1, &Weapon::lightbloodknifetextureptr ); - glDeleteTextures( 1, &Weapon::bloodknifetextureptr ); - glDeleteTextures( 1, &Weapon::swordtextureptr ); - glDeleteTextures( 1, &Weapon::lightbloodswordtextureptr ); - glDeleteTextures( 1, &Weapon::bloodswordtextureptr ); + Weapon::stafftextureptr.destroy(); + Weapon::knifetextureptr.destroy(); + Weapon::lightbloodknifetextureptr.destroy(); + Weapon::bloodknifetextureptr.destroy(); + Weapon::swordtextureptr.destroy(); + Weapon::lightbloodswordtextureptr.destroy(); + Weapon::bloodswordtextureptr.destroy(); }