glEnable(GL_BLEND);
glEnable(GL_LIGHTING);
terrainlight=terrain.getLighting(player[k].coords.x,player[k].coords.z);
- distance=findDistancefast(&viewer,&player[k].coords);
+ distance=distsq(&viewer,&player[k].coords);
distance=(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance;
glColor4f(terrainlight.x,terrainlight.y,terrainlight.z,distance);
if(distance>=1)
}
if(!cameramode&&musictype==stream_fighttheme)
- playerdist=findDistancefastflat(&player[0].coords,&viewer);
+ playerdist=distsqflat(&player[0].coords,&viewer);
else
playerdist=-100;
glPushMatrix();
glTranslatef(hawkcoords.x,hawkcoords.y,hawkcoords.z);
glRotatef(hawkyaw,0,1,0);
glTranslatef(25,0,0);
- distance=findDistancefast(&viewer,&realhawkcoords)*1.2;
+ distance=distsq(&viewer,&realhawkcoords)*1.2;
glColor4f(light.color[0],light.color[1],light.color[2],(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance);
if((viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance>1)
glColor4f(light.color[0],light.color[1],light.color[2],1);
glEnable(GL_BLEND);
glEnable(GL_LIGHTING);
terrainlight=terrain.getLighting(player[k].coords.x,player[k].coords.z);
- distance=findDistancefast(&viewer,&player[k].coords);
+ distance=distsq(&viewer,&player[k].coords);
distance=(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance;
glColor4f(terrainlight.x,terrainlight.y,terrainlight.z,distance);
if(distance>=1)
float distance=0;
closest=currenthotspot;
for(i=0;i<numhotspots;i++){
- distance=findDistancefast(&player[0].coords,&hotspot[i]);
+ distance=distsq(&player[0].coords,&hotspot[i]);
if(closestdist==-1||distance<closestdist){
- if(findDistancefast(&player[0].coords,&hotspot[i])<hotspotsize[i]&&((hotspottype[i]<=10&&hotspottype[i]>=0)||(hotspottype[i]<=40&&hotspottype[i]>=20))){
+ if(distsq(&player[0].coords,&hotspot[i])<hotspotsize[i]&&((hotspottype[i]<=10&&hotspottype[i]>=0)||(hotspottype[i]<=40&&hotspottype[i]>=20))){
closestdist=distance;
closest=i;
}
currenthotspot=closest;
if(currenthotspot!=-1){
if(hotspottype[closest]<=10){
- if(findDistancefast(&player[0].coords,&hotspot[closest])<hotspotsize[closest])
+ if(distsq(&player[0].coords,&hotspot[closest])<hotspotsize[closest])
tutorialstagetime=0;
tutorialmaxtime=1;
tutorialopac=tutorialmaxtime-tutorialstagetime;
player[participantfocus[whichdialogue][j]].yaw=participantyaw[whichdialogue][participantfocus[whichdialogue][j]];
player[participantfocus[whichdialogue][j]].targetyaw=participantyaw[whichdialogue][participantfocus[whichdialogue][j]];
player[participantfocus[whichdialogue][j]].velocity=0;
- player[participantfocus[whichdialogue][j]].targetanimation=player[participantfocus[whichdialogue][j]].getIdle();
- player[participantfocus[whichdialogue][j]].targetframe=0;
+ player[participantfocus[whichdialogue][j]].animTarget=player[participantfocus[whichdialogue][j]].getIdle();
+ player[participantfocus[whichdialogue][j]].frameTarget=0;
}
directing=0;
indialogue=0;
float tempdist;
//~ int whichclosest;
for(i=0;i<objects.numobjects;i++){
- tempdist=findDistancefast(¢er,&objects.position[i]);
+ tempdist=distsq(¢er,&objects.position[i]);
if(tempdist>maxdistance){
//~ whichclosest=i;
maxdistance=tempdist;
}
for(i=0;i<numplayers;i++){
if(!player[i].dead){
- tempdist=findDistancefast(¢er,&player[i].coords);
+ tempdist=distsq(¢er,&player[i].coords);
if(tempdist>maxdistance){
//~ whichclosest=i;
maxdistance=tempdist;
glTranslatef(-(center.x/terrain.scale/256*-2+1),(center.z/terrain.scale/256*-2+1),0);
for(i=0;i<objects.numobjects;i++){
if(objects.type[i]==treetrunktype){
- distcheck=findDistancefast(&player[0].coords,&objects.position[i]);
+ distcheck=distsq(&player[0].coords,&objects.position[i]);
if(distcheck<mapviewdist){
Mapcircletexture.bind();
glColor4f(0,.3,0,opac*(1-distcheck/mapviewdist));
}
}
if(objects.type[i]==boxtype){
- distcheck=findDistancefast(&player[0].coords,&objects.position[i]);
+ distcheck=distsq(&player[0].coords,&objects.position[i]);
if(distcheck<mapviewdist){
Mapboxtexture.bind();
glColor4f(.4,.4,.4,opac*(1-distcheck/mapviewdist));
}
}
for(i=0;i<numplayers;i++){
- distcheck=findDistancefast(&player[0].coords,&player[i].coords);
+ distcheck=distsq(&player[0].coords,&player[i].coords);
if(distcheck<mapviewdist){
glPushMatrix();
Maparrowtexture.bind();