extern bool midweird;
extern bool proportionweird;
extern bool vertexweird[6];
-extern GLubyte texturearray[512*512*3];
extern XYZ envsound[30];
extern float envsoundvol[30];
extern float envsoundlife[30];
extern bool gamestarted;
-void Person::CheckKick(){
- static XYZ relative;
- static int i;
-
- float damagemult=1*power;
- if(creature==wolftype)damagemult=2.5*power;
- damagemult*=power;
-
- if(hasvictim)
- if(targetanimation==rabbitkickanim&&victim&&victim!=this&¤tframe>=2&¤tanimation==rabbitkickanim){
- if(findDistancefast(&coords,&victim->coords)<1.2){
- if(!victim->skeleton.free){
- relative=velocity;
- Normalise(&relative);
- relative=coords+relative*1;
- if(animation[victim->targetanimation].height!=lowheight){
- victim->spurt=1;
- DoBlood(.2,250);
- if(tutoriallevel!=1)
- emit_sound_at(heavyimpactsound, victim->coords);
- victim->RagDoll(0);
- relative=velocity;
- relative.y=0;
- Normalise(&relative);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*120*damagemult;
- }
- victim->Puff(neck);
- victim->DoDamage(100*damagemult/victim->protectionhigh);
- if(id==0)camerashake+=.4;
-
- target=0;
- currentframe=3;
- targetanimation=backflipanim;
- targetframe=4;
- velocity=facing*-10;
- velocity.y=5;
- skeleton.free=0;
- if(id==0)OPENAL_SetPaused(channels[whooshsound], false);
-
- award_bonus(id, cannon);
- }
- else if (victim->isCrouch()){
- targetanimation=rabbitkickreversedanim;
- currentanimation=rabbitkickreversedanim;
- victim->currentanimation=rabbitkickreversalanim;
- victim->targetanimation=rabbitkickreversalanim;
- targettilt2=0;
- currentframe=0;
- targetframe=1;
- target=0;
- velocity=0;
- victim->oldcoords=victim->coords;
- coords=victim->coords;
- victim->targetrotation=targetrotation;
- victim->victim=this;
- }
- }
- }
- }
+void Person::CheckKick()
+{
+ if (!(hasvictim
+ && (targetanimation == rabbitkickanim
+ && victim
+ && victim != this
+ && currentframe >= 2
+ && currentanimation == rabbitkickanim)
+ && (findDistancefast(&coords,&victim->coords) < 1.2)
+ && (!victim->skeleton.free)))
+ return;
+
+ if (animation[victim->targetanimation].height!=lowheight)
+ {
+ float damagemult = (creature == wolftype ? 2.5 : 1.) * power * power;
+ XYZ relative = velocity;
+ relative.y=0;
+ Normalise(&relative);
+
+ victim->spurt=1;
+ DoBlood(.2,250);
+ if(tutoriallevel!=1)
+ emit_sound_at(heavyimpactsound, victim->coords);
+ victim->RagDoll(0);
+ for(int i=0;i<victim->skeleton.num_joints;i++){
+ victim->skeleton.joints[i].velocity+=relative*120*damagemult;
+ }
+ victim->Puff(neck);
+ victim->DoDamage(100*damagemult/victim->protectionhigh);
+ if(id==0)camerashake+=.4;
+
+ target=0;
+ currentframe=3;
+ targetanimation=backflipanim;
+ targetframe=4;
+ velocity=facing*-10;
+ velocity.y=5;
+ skeleton.free=0;
+ if(id==0)OPENAL_SetPaused(channels[whooshsound], false);
+
+ award_bonus(id, cannon);
+ }
+ else if (victim->isCrouch())
+ {
+ targetanimation=rabbitkickreversedanim;
+ currentanimation=rabbitkickreversedanim;
+ victim->currentanimation=rabbitkickreversalanim;
+ victim->targetanimation=rabbitkickreversalanim;
+ targettilt2=0;
+ currentframe=0;
+ targetframe=1;
+ target=0;
+ velocity=0;
+ victim->oldcoords=victim->coords;
+ coords=victim->coords;
+ victim->targetrotation=targetrotation;
+ victim->victim=this;
+ }
}
void Person::CatchFire(){
}
}
glBindTexture(GL_TEXTURE_2D,skeleton.drawmodel.textureptr);
- if(detail!=2||osx)DoMipmaps(5,0,0,skeleton.skinsize,skeleton.skinsize);
- else DoMipmaps(0,startx/realtexdetail,endx/realtexdetail,starty/realtexdetail,endy/realtexdetail);
+ DoMipmaps();
bleedxint=0;
bleedyint=0;
}
}
glBindTexture(GL_TEXTURE_2D,skeleton.drawmodel.textureptr);
- if(detail!=2||osx)DoMipmaps(5,0,0,skeleton.skinsize,skeleton.skinsize);
- else DoMipmaps(0,startx/realtexdetail,endx/realtexdetail,starty/realtexdetail,endy/realtexdetail);
+ DoMipmaps();
bleedy=(1+coordsy)*512;
bleedx=coordsx*512;
}
-void Person::DoMipmaps(int howmanylevels,float startx, float endx, float starty, float endy){
- int i,j,k;
- static float temp;
- static int bytesPerPixel=3;
- static int newsize,totalsize,rowsize,bigstep,smallstep,sum;
- static int newstartx,newstarty,newendx,newendy;
- static int newnewstartx,newnewstarty,newnewendx,newnewendy;
- static int which;
- static float sizemult;
- /*
- for(i=0;i<skeleton.skinsize*skeleton.skinsize*bytesPerPixel;i++){
- texture[i]=skeleton.skinText[i];
- }
- */
- if((!osx||howmanylevels)){
-
- if(startx<0)startx=0;
- if(starty<0)starty=0;
- if(endx>skeleton.skinsize-1)endx=skeleton.skinsize-1;
- if(endy>skeleton.skinsize-1)endy=skeleton.skinsize-1;
- if((endx>startx&&endy>starty)||howmanylevels){
-
- newstartx=startx;
- newstarty=starty;
- newendx=endx;
- newendy=endy;
-
- for(i=startx;i<endx;i++){
- for(j=starty;j<endy;j++){
- texturearray[(i-newstartx)*(newendy-newstarty)*3+(j-newstarty)*3+0]=skeleton.skinText[i*skeleton.skinsize*3+j*3+0];
- texturearray[(i-newstartx)*(newendy-newstarty)*3+(j-newstarty)*3+1]=skeleton.skinText[i*skeleton.skinsize*3+j*3+1];
- texturearray[(i-newstartx)*(newendy-newstarty)*3+(j-newstarty)*3+2]=skeleton.skinText[i*skeleton.skinsize*3+j*3+2];
- }
- }
-
- glBindTexture(GL_TEXTURE_2D,skeleton.drawmodel.textureptr);
-
- if(!howmanylevels){
- if(!osx)glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS,GL_TRUE);
- glTexSubImage2D(GL_TEXTURE_2D,0,starty,startx,endy-starty,endx-startx,GL_RGB,GL_UNSIGNED_BYTE,texturearray);
- if(!osx)glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS,GL_FALSE);
- }
-
- newsize=skeleton.skinsize;
-
- if(howmanylevels)
- gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGB, skeleton.skinsize, skeleton.skinsize, GL_RGB, GL_UNSIGNED_BYTE, &skeleton.skinText[0] );
- }
- /*for(j=1;j<=howmanylevels;j++){
- if(j==1)texpointer=&skeleton.skinText[0];
- else texpointer=&texture[0];
-
- totalsize=int( newsize*newsize*bytesPerPixel);
- rowsize=int( newsize*bytesPerPixel );
- bigstep=bytesPerPixel*newsize*2;
- smallstep=bytesPerPixel*2;
-
- which=0;
-
-
-
- glTexSubImage2D(GL_TEXTURE_2D,j,0,0,newsize/2,newsize/2,GL_RGB,GL_UNSIGNED_BYTE,texture);
- newsize/=2;
- }*/
- }
-}
-
void Person::Reverse(){
if(victim->aitype==playercontrolled||hostiletime>1)
bleeding-=multiplier*.3;
if(bloodtoggle==2){
glBindTexture(GL_TEXTURE_2D,skeleton.drawmodel.textureptr);
- if(bleeding<=0&&(detail!=2||osx))DoMipmaps(5,0,0,skeleton.skinsize,skeleton.skinsize);
+ if(bleeding<=0&&(detail!=2||osx))DoMipmaps();
}
}
}
if(!osx&&detail>1){
glBindTexture(GL_TEXTURE_2D,skeleton.drawmodel.textureptr);
- DoMipmaps(0,startx,endx,starty,endy);
+ DoMipmaps();
}
if(!skeleton.free){