]> git.jsancho.org Git - lugaru.git/blobdiff - Source/GameDraw.cpp
renames for readability
[lugaru.git] / Source / GameDraw.cpp
index 11a94010c5b5ebd1aedce2ed4690b21771498e02..a6ab119d200f9277b7db76344693dfaa5e94d679 100644 (file)
@@ -404,9 +404,9 @@ int Game::DrawGLScene(StereoSide side)
                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);
@@ -445,7 +445,7 @@ int Game::DrawGLScene(StereoSide side)
                                        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)
@@ -470,7 +470,7 @@ int Game::DrawGLScene(StereoSide side)
                }
 
                if(!cameramode&&musictype==stream_fighttheme)
-            playerdist=findDistancefastflat(&player[0].coords,&viewer);
+            playerdist=distsqflat(&player[0].coords,&viewer);
                else
             playerdist=-100;
                glPushMatrix();
@@ -490,7 +490,7 @@ int Game::DrawGLScene(StereoSide side)
                        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);
@@ -508,7 +508,7 @@ int Game::DrawGLScene(StereoSide side)
                                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)
@@ -917,9 +917,9 @@ int Game::DrawGLScene(StereoSide side)
                 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;
                         }
@@ -929,7 +929,7 @@ int Game::DrawGLScene(StereoSide side)
                     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;
@@ -962,8 +962,8 @@ int Game::DrawGLScene(StereoSide side)
                             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;
@@ -1473,7 +1473,7 @@ int Game::DrawGLScene(StereoSide side)
                        float tempdist;
                        //~ int whichclosest;
                        for(i=0;i<objects.numobjects;i++){
-                               tempdist=findDistancefast(&center,&objects.position[i]);
+                               tempdist=distsq(&center,&objects.position[i]);
                                if(tempdist>maxdistance){
                                        //~ whichclosest=i;
                                        maxdistance=tempdist;
@@ -1481,7 +1481,7 @@ int Game::DrawGLScene(StereoSide side)
                        }
                        for(i=0;i<numplayers;i++){
                                if(!player[i].dead){
-                                       tempdist=findDistancefast(&center,&player[i].coords);
+                                       tempdist=distsq(&center,&player[i].coords);
                                        if(tempdist>maxdistance){
                                                //~ whichclosest=i;
                                                maxdistance=tempdist;
@@ -1500,9 +1500,9 @@ int Game::DrawGLScene(StereoSide side)
                        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);
@@ -1522,9 +1522,9 @@ int Game::DrawGLScene(StereoSide side)
                                        }
                                }
                                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);
@@ -1545,7 +1545,7 @@ int Game::DrawGLScene(StereoSide side)
                                }
                        }
                        if(editorenabled){
-                               glBindTexture( GL_TEXTURE_2D, Mapcircletexture);
+                               Mapcircletexture.bind();
                                for(i=0;i<numboundaries;i++){
                                        glColor4f(0,0,0,opac/3);
                                        glPushMatrix();
@@ -1565,10 +1565,10 @@ int Game::DrawGLScene(StereoSide side)
                                }
                        }
                        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));
@@ -2078,7 +2078,7 @@ void DrawMenu() {
                                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);
@@ -2138,7 +2138,7 @@ void DrawMenu() {
                                                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);