glDisable(GL_BLEND);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- glBindTexture( GL_TEXTURE_2D, terraintexture);
+ terraintexture.bind();
terrain.draw(0);
- glBindTexture( GL_TEXTURE_2D, terraintexture2);
+ terraintexture2.bind();
terrain.draw(1);
//glBindTexture( GL_TEXTURE_2D, terraintexture3);
//glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
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){
- glBindTexture( GL_TEXTURE_2D, Mapcircletexture);
+ Mapcircletexture.bind();
glColor4f(0,.3,0,opac*(1-distcheck/mapviewdist));
glPushMatrix();
glTranslatef(objects.position[i].x/terrain.scale/256*-2+1,objects.position[i].z/terrain.scale/256*2-1,0);
}
}
if(objects.type[i]==boxtype){
- distcheck=findDistancefast(&player[0].coords,&objects.position[i]);
+ distcheck=distsq(&player[0].coords,&objects.position[i]);
if(distcheck<mapviewdist){
- glBindTexture( GL_TEXTURE_2D, Mapboxtexture);
+ Mapboxtexture.bind();
glColor4f(.4,.4,.4,opac*(1-distcheck/mapviewdist));
glPushMatrix();
glTranslatef(objects.position[i].x/terrain.scale/256*-2+1,objects.position[i].z/terrain.scale/256*2-1,0);
}
}
if(editorenabled){
- glBindTexture( GL_TEXTURE_2D, Mapcircletexture);
+ Mapcircletexture.bind();
for(i=0;i<numboundaries;i++){
glColor4f(0,0,0,opac/3);
glPushMatrix();
}
}
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();
- glBindTexture( GL_TEXTURE_2D, Maparrowtexture);
+ Maparrowtexture.bind();
if(i==0)glColor4f(1,1,1,opac);
else if(player[i].dead==2||player[i].howactive>typesleeping)glColor4f(0,0,0,opac*(1-distcheck/mapviewdist));
else if(player[i].dead)glColor4f(.3,.3,.3,opac*(1-distcheck/mapviewdist));
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
glEnable(GL_TEXTURE_2D);
- glBindTexture( GL_TEXTURE_2D, Game::Mainmenuitems[4]);
+ Game::Mainmenuitems[4].bind();
glBegin(GL_QUADS);
glTexCoord2f(0,0);
glVertex3f(-1,-1,0);
glTranslatef(1,-1,0);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glColor4f(1,1,1,1);
- glBindTexture( GL_TEXTURE_2D, Game::cursortexture);
+ Game::cursortexture.bind();
glPushMatrix();
//glScalef(.25,.25,.25);
glBegin(GL_QUADS);